<?php

/**
 * IndexController - The default controller class
 * 
 * @author
 * @version 
 */

class Inqman_TestController extends AbstractController    
{
    public function preDispatch()
    {
        
    }
    
    
    public function testAction()
    {
//        $model = new EventActionModel();
//        $model->read();
//        $result = $model->getTargetGroupsToSerivceByEventActionId(3, 4);
        
//        $model = new EventModel();
//        $result = $model->getEventActions();
//
//        $model = new EventModel();
//        $result = $model->getServiceEventsPerEventAction(2);
        
//        $serviceModel = new ServiceModel();
//        $services = $serviceModel->getAllServices();
//        
//        $roleModel = new RoleModel();
//        foreach ($services as $service) {
//             $roleModel->prepareLocalAcl($service['id']);
//        }
//        
        
//        $model = new RoleModel();
//        //$result = $model->getUserRoles(4);
//        $result = $model->prepareLocalAcl(1);
//        $result = $model->getUserRoles(1);
//        $flg = $this->_checkAcl('service', 'create', 1, array_keys($result));
//        var_dump($flg);
        //var_dump($result->isAllowed('TEST1_ADVISER', 'TEST1_INQUIRY', 'TAKECHARGE'));
        
//        $model = new Inqman_ServiceModel();
//        $result = $model->getAllServiceOptions();
//        $result = $model->getOneService(1);
//        $result = $model->getEnableServices(4);
//        $result = $model->getEnableServiceOptions(4);
        
//        $model = new Inqman_AclModel();
//        $result = $model->getServiceAuthorities(2);
//        $service_model = new Inqman_ServiceModel();
//        $service = $service_model->getOneService(2);
//        $result = $service['code'];
//        $result = $model->prepareLocalAcl(2);
//$result = $this->_config->workflow->approve->inquiry->accept;
//        $result = $this->_checkAcl('user', 'read', 1);
//        $roles = array_keys($this->_getUserInfo()->roles);
//        $result = array(
//            'INQUIRY_READ'   => $model->checkAcl('inquiry', 'read', 2, $roles),
//            'UNACCEPT_READ'  => $model->checkAcl('unaccept', 'read', 2, $roles),
//            'INQUIRY_ACCEPT' => $model->checkAcl('inquiry', 'accept', 2, $roles),
//            'UNAPPROVE_READ' => $model->checkAcl('unapprove', 'read', 2, $roles),
//            'INQUIRY_APPROVE' => $model->checkAcl('inquiry', 'approve', 2, $roles),
//            'COMMENT_READ'   => $model->checkAcl('comment', 'read', 2, $roles),
//            'REPLY_READ'     => $model->checkAcl('reply', 'read', 2, $roles),
//        );
        
//        $event_model = new Inqman_EventModel();
//        $result = $event_model->getEvanetActionTarget(2, 12);
//        
//        $acl_model = new Inqman_AclModel();
//        $result = $acl_model->getUsersByAuthority(2);
//        
//        $mailtemplate_model = new Inqman_MailtemplateModel();
//        $result = $mailtemplate_model->getSysvars();
//        
//        $content = 'テストです。 {$service_name}　への問い合わせ
//        件名：{$inquiry_subject}';
//        preg_match_all('/{\$[a-zA-z\-]+}/i', $content, $result);
//        
//        $result = $mailtemplate_model->replaceSysvar($content, array('service_id'=>2, 'inquiry_id'=>8));
        
//        $pop_server = new Inqman_PopServer(6);
//        $result = $pop_server->_checkAclByMailaddress('tutiya@example.com', ACL_RESOURCE_KEY_REPLY, ACL_PRIVILEGE_KEY_CREATE, 6);
//        $result = $pop_server->perform();
//        $values = array('subject'=>'Re:[PHPTEC:15]起票します', 'from'=>'tutiya@example.com');
//        $result = $pop_server->_delivery($values);
        
//        $mail_sender = new Inqman_MailSender();
//        $mail_sender->sendBroadcastMail('php_tec@example.com', $values, 'TEST MAIL FROM INQMAN');
        $result = mb_http_output();
        $this->view->assign('result', $result);
    }
}
