Example #1
0
 protected function _initApplication()
 {
     $defaultDb = $this->multidb->getDb();
     Oray_Dao_Abstract::setDefaultAdapter($defaultDb);
     Oray_Dao_Abstract::registerErrorHandler(array($this, 'daoErrorHandler'));
     Tudu_Dao_Manager::setDbs(array(Tudu_Dao_Manager::DB_MD => $this->multidb->getDb('md')));
     Tudu_User::setMemcache($this->getResource('memcache'));
     //set_error_handler(array($this, 'errorHandler'));
 }
Example #2
0
 public function init()
 {
     parent::init();
     $this->_helper->viewRenderer->setNeverRender();
     $this->lang = Tudu_Lang::getInstance()->load(array('common', 'tudu'));
     if (!$this->_user->isLogined()) {
         return $this->json(false, $this->lang['login_timeout']);
     }
     Tudu_Dao_Manager::setDbs(array(Tudu_Dao_Manager::DB_MD => $this->multidb->getDefaultDb(), Tudu_Dao_Manager::DB_TS => $this->getTsDb()));
 }
Example #3
0
 /**
  * 初始化
  *
  * 检测用户登录状态
  * 检查APP用户权限
  */
 public final function init()
 {
     parent::init();
     Tudu_Dao_Manager::setDbs(array(Tudu_Dao_Manager::DB_MD => $this->multidb->getDefaultDb(), Tudu_Dao_Manager::DB_TS => $this->getTsDb()));
     $appInfo = $this->_getAppInfo();
     $actionName = $this->_request->getActionName();
     // 没有使用权限
     if ($actionName != 'disable' && (null === $appInfo || $appInfo->orgId != $this->_user->orgId)) {
         return $this->jump('./disable');
     }
     $this->_init();
 }
Example #4
0
 /**
  *
  */
 protected function _initApplication()
 {
     //$defaultDb = $this->multidb->getDb();
     //Oray_Db_Helper::getInstance()->set('tudu-md', $defaultDb);
     Oray_Dao_Abstract::setDefaultAdapter($this->multidb->getDb());
     Oray_Dao_Abstract::registerErrorHandler(array($this, 'daoErrorHandler'));
     Tudu_Dao_Manager::setDbs(array(Tudu_Dao_Manager::DB_MD => $this->multidb->getDb('md')));
     Tudu_User::setMemcache($this->getResource('memcache'));
     $resourceManager = new Tudu_Model_ResourceManager_Registry();
     $resourceManager->setResource('config', $this->_options);
     Tudu_Model::setResourceManager($resourceManager);
     //set_error_handler(array($this, 'errorHandler'));
 }
Example #5
0
 public function init()
 {
     if ($cookies = $this->_request->getParam('cookies')) {
         if ($cookies = @unserialize($cookies)) {
             foreach ($cookies as $key => $val) {
                 $_COOKIE[$key] = $val;
             }
         }
     }
     parent::init();
     $this->lang = Tudu_Lang::getInstance()->load(array('common', 'user'));
     $this->view->LANG = $this->lang;
     Tudu_Dao_Manager::setDbs(array(Tudu_Dao_Manager::DB_TS => $this->getDb('ts1')));
 }
Example #6
0
 public function init()
 {
     $this->_helper->viewRenderer->setNeverRender();
     parent::init();
     $this->lang = Tudu_Lang::getInstance()->load(array('common', 'tudu'));
     if (!$this->_user->isLogined()) {
         return $this->json(false, $this->lang['login_timeout']);
     }
     // IP或登录时间无效
     if (!empty($this->session->auth['invalid'])) {
         return $this->json(false, $this->lang['forbid_access']);
     }
     Tudu_Dao_Manager::setDbs(array(Tudu_Dao_Manager::DB_MD => $this->multidb->getDefaultDb(), Tudu_Dao_Manager::DB_TS => $this->getTsDb()));
     $this->manager = Tudu_Tudu_Manager::getInstance();
 }
Example #7
0
 /**
  * 初始化
  *
  *
  * 获取APP请求的文件以及操作
  * 判断APP使用
  * 判断当前用户模块权限
  */
 public function init()
 {
     parent::init();
     if (!$this->_user->isLogined()) {
         $this->jump(null, array('error' => 'timeout'));
     }
     $tsId = self::DEFAULT_TS_ID;
     if ($this->_user) {
         $tsId = $this->_user->tsId;
     }
     // 后台用户验证信息
     /*if ($this->session->admin) {
     
                 $this->_admin   = Tudu_Admin_Admin::getInstance();
     
                 $this->_admin->setAttributes($this->session->admin);
     
                 $this->_orgId   = $this->_admin->orgId;
     
                 $tsId = $this->_admin->tsId;
             }*/
     Tudu_Dao_Manager::setDbs(array(Tudu_Dao_Manager::DB_MD => $this->multidb->getDefaultDb(), Tudu_Dao_Manager::DB_TS => $this->multidb->getDb('ts' . $tsId), Tudu_Dao_Manager::DB_APP => $this->multidb->getDb('app')));
 }
Example #8
0
 /**
  * 接收参数,通过接口方 OpenApi 进行验证
  * 登录图度
  */
 public function indexAction()
 {
     $query = $this->_request->getQuery();
     $config = $this->getInvokeArg('bootstrap')->getOptions();
     $multidb = $this->getInvokeArg('bootstrap')->getResource('multidb');
     $time = time();
     Tudu_Dao_Manager::setDbs(array(Tudu_Dao_Manager::DB_TS => $multidb->getDb('ts1')));
     // 缺少验证接口标识参数
     if (empty($query['from'])) {
         return $this->_redirect('http://www.tudu.com/');
     }
     $from = $query['from'];
     $className = 'Model_OpenApi_' . ucfirst($query['from']);
     $classFile = 'Model/OpenApi/' . ucfirst($query['from']) . '.php';
     // 缺少配置参数
     if (empty($config['openapi'][strtolower($from)])) {
         return $this->_redirect('http://www.tudu.com/');
     }
     $params = array_merge($config['openapi'][strtolower($from)], $query);
     header('P3P: CP=”CURa ADMa DEVa PSAo PSDo OUR BUS UNI PUR INT DEM STA PRE COM NAV OTC NOI DSP COR”');
     try {
         require_once $classFile;
         // 进行登录验证
         call_user_func(array($className, 'auth'), $params);
         // 查找应用组织关联表
         $daoAssociate = Tudu_Dao_Manager::getDao('Dao_Md_Org_Associate', Tudu_Dao_Manager::DB_MD);
         // 获取用户信息
         $params = array_merge($config['openapi'][strtolower($from)], array('uid' => $query['uu_id']));
         $userInfo = call_user_func(array($className, 'getUserInfo'), $params);
         $orgId = $daoAssociate->getOrgIdByUid($from, $userInfo['uid']);
         if (false === $orgId) {
             $orgId = $this->_getOrgId($from);
             // 创建组织
             require_once 'Model/Org/Org.php';
             Model_Org_Org::setResource('config', $config);
             Model_Org_Org::createOrg($orgId, array('userid' => 'admin', 'password' => md5(Oray_Function::randKeys(16)), 'truename' => $userInfo['truename'], 'orgname' => $userInfo['orgname']));
             // 创建关联
             $daoAssociate->createAssociate(array('orgid' => $orgId, 'from' => $from, 'uid' => $userInfo['uid'], 'truename' => $userInfo['truename'], 'email' => $userInfo['email'], 'mobile' => $userInfo['mobile'], 'tel' => $userInfo['tel'], 'createtime' => time()));
         }
         // 获取用户信息
         $adapter = new Tudu_Auth_Adapter_User(Tudu_Dao_Manager::getDb(Tudu_Dao_Manager::DB_MD));
         $adapter->setUsername('admin@' . $orgId)->setAuto(true);
         $result = $adapter->authenticate();
         $names = $config['cookies'];
         if (!$result->isValid()) {
             $this->_setCookies(array($names['auth'] => false, $names['username'] => false));
             return $this->_redirect('http://www.tudu.com/');
         }
         $identity = $result->getIdentity();
         // 登录
         if (Zend_Session::isStarted()) {
             session_unset();
             Zend_Session::namespaceUnset(self::SESSION_NAMESPACE);
             Zend_Session::regenerateId();
         }
         $session = new Zend_Session_Namespace(self::SESSION_NAMESPACE, true);
         $session->auth = array_merge($identity, array('logintime' => $time));
         $session->auth['appinvoker'] = $from;
         // 验证相关的Cookies
         $this->_setCookies(array($names['username'] => $identity['username'], $names['server'] => $orgId . '.tudu.com'), null);
         // 其它场合要用到的Cookies,永久。
         $this->_setCookies(array($names['track'] => base64_encode('http://www.tudu.com/login')), $time + 86400 * 365);
         // 同时要登录后台
         $adapter = new Tudu_Auth_Adapter_Admin(array('db' => Tudu_Dao_Manager::getDb(Tudu_Dao_Manager::DB_MD)));
         $adapter->setUsername($identity['username'])->setAuto(true);
         $result = $adapter->authenticate();
         if ($result->isValid()) {
             $session->admin = array_merge($result->getIdentity(), array('logintime' => $time));
         }
         // 操作失败
     } catch (Exception $e) {
         return $this->_redirect('http://www.tudu.com/');
     }
     return $this->_redirect('http://online-app.tudu.com/frame-inc/');
 }
Example #9
0
 /**
  * 初始化
  */
 public function init()
 {
     $this->_bootstrap = $this->getInvokeArg('bootstrap');
     $this->_multidb = $this->_bootstrap->getResource('multidb');
     $this->_options = $this->_bootstrap->getOptions();
     $this->_helper->viewRenderer->view->setBasePath(APPLICATION_PATH . '/modules/foreign/views');
     $this->_helper->viewRenderer->setViewScriptPathSpec(':module#:controller#:action.:suffix');
     $this->_tsId = $this->_request->getParam('ts');
     $tuduId = $this->_request->getParam('tid');
     $unId = $this->_request->getParam('fid');
     if (!$this->_tsId || !$tuduId || !$unId) {
         $this->getResponse()->setHttpResponseCode(404);
         $this->getResponse()->sendResponse();
         return;
     }
     Tudu_Dao_Manager::setDbs(array(Tudu_Dao_Manager::DB_TS => $this->getTsDb($this->_tsId)));
     $this->_manager = Tudu_Tudu_Manager::getInstance();
     $this->_deliver = new Tudu_Deliver($this->getTsDb($this->_tsId));
     $this->_tudu = $this->_manager->getTuduById($tuduId, $unId);
     $this->_user = $this->_manager->getUser($tuduId, $unId);
     if (null !== $this->_user) {
         // 用户请求语言
         $language = $this->_request->getHeader('ACCEPT_LANGUAGE');
         if (strpos($language, 'zh') !== false) {
             if (strpos($language, 'hk') !== false || strpos($language, 'tw') !== false) {
                 $language = 'zh_TW';
             } else {
                 $language = 'zh_CN';
             }
         } else {
             $language = 'en_US';
         }
         $this->_user['option'] = array('language' => $language);
         if (null !== $this->_tudu) {
             $this->_session = new Zend_Session_Namespace(self::SESSION_NAMESPACE, true);
             $this->_sessionId = Zend_Session::getId();
             //
             /*if (isset($this->_session->foreign['uniqueid']) && $this->_session->foreign['uniqueid'] != $this->_user['uniqueid']) {
                   $this->_destroySession();
               }*/
             $this->_session->foreign['uniqueid'] = $this->_user['uniqueid'];
             $this->_session->foreign['address'] = $this->_user['email'] ? $this->_user['email'] : $this->_user['uniqueid'];
             $this->_session->foreign['truename'] = $this->_user['truename'];
             $this->_session->foreign['logintime'] = time();
             $this->_session->foreign['orgid'] = $this->_tudu->orgId;
             $this->_session->foreign['tsid'] = $this->_tsId;
             $this->_session->foreign['lasttime'] = time();
             if (empty($this->_session->auth)) {
                 $this->_session->auth = array('uniqueid' => $this->_user['uniqueid'], 'address' => $this->_session->foreign['address'], 'logintime' => $this->_session->foreign['logintime']);
             }
         }
         $this->_timestamp = time();
         $this->view->options = $this->_options;
         $this->view->tsid = $this->_tsId;
         $this->view->user = $this->_user;
     }
 }
 /**
  * 发送操作
  */
 public function sendAction()
 {
     $post = $this->_request->getPost();
     $action = self::ACTION_SEND;
     $time = time();
     if (!empty($post['action']) && $post['action'] == 'save') {
         $action = self::ACTION_SAVE;
     }
     if (!empty($post['forward'])) {
         $action = self::ACTION_FORWARD;
     } elseif (!empty($post['divide'])) {
         $action = self::ACTION_DIVIDE;
     } elseif (!empty($post['review'])) {
         $action = self::ACTION_REVIEW;
     } elseif (!empty($post['apply'])) {
         $action = self::ACTION_APPLY;
     } elseif (!empty($post['invite'])) {
         $action = self::ACTION_INVITE;
     }
     /**
      * @see Model_Tudu_Tudu
      */
     require_once 'Model/Tudu/Tudu.php';
     $tudu = new Model_Tudu_Tudu();
     $this->_formatParams($tudu, $post);
     $tudu->setAttributes(array('orgid' => $this->_user->orgId, 'uniqueid' => $this->_user->uniqueId, 'email' => $this->_user->userName, 'from' => $this->_user->userName . ' ' . $this->_user->trueName, 'poster' => $this->_user->trueName, 'createtime' => $time, 'lastupdatetime' => $time, 'operation' => $action));
     // 发送对象
     $config = $this->bootstrap->getOption('httpsqs');
     $tuduconf = $this->bootstrap->getOption('tudu');
     $sendType = isset($tuduconf['send']) ? ucfirst($tuduconf['send']['class']) : 'Common';
     $sendClass = 'Model_Tudu_Send_' . $sendType;
     if (!empty($tuduconf['send']['params'])) {
         $params = $tuduconf['send']['params'];
     } elseif ($sendType == 'Common') {
         $params = array('httpsqs' => $config);
     }
     $modelSend = new $sendClass($params);
     $className = 'Model_Tudu_Compose_' . ucfirst($action);
     $model = new $className();
     // 添加图度工作流相关流程
     if ($tudu->type == 'task' || $tudu->type == 'notice' || in_array($action, array(self::ACTION_REVIEW, self::ACTION_FORWARD))) {
         $tudu->setExtension(new Model_Tudu_Extension_Flow());
     }
     // 周期任务
     if (in_array($action, array(self::ACTION_SAVE, self::ACTION_SEND)) && ($tudu->type == 'task' || $tudu->type == 'meeting')) {
         if ($tudu->cycle) {
             $tudu->setExtension(new Model_Tudu_Extension_Cycle($this->_getCycleParams($post)));
         }
     }
     // 处理投票
     if ($tudu->type == 'discuss' && !empty($post['vote'])) {
         $this->_prepareVoteParams($tudu, $post);
     }
     // 图度组支持
     if ($tudu->type == 'task' && !empty($post['chidx']) || $action == self::ACTION_DIVIDE && !empty($post['chidx'])) {
         $group = new Model_Tudu_Extension_Group();
         foreach ($post['chidx'] as $suffix) {
             $suffix = '-' . $suffix;
             $child = new Model_Tudu_Tudu();
             $this->_formatParams($child, $post, $suffix);
             $child->setExtension(new Model_Tudu_Extension_Flow());
             if ($child->cycle) {
                 $child->setExtension(new Model_Tudu_Extension_Cycle($this->_getCycleParams($post, $suffix)));
             }
             $group->appendChild($child);
         }
         Model_Tudu_Extension_Handler_Group::setSendModel($modelSend);
         $tudu->setExtension($group);
     }
     // 处理会议
     if ($tudu->type == 'meeting' && $action != self::ACTION_INVITE) {
         $meeting = new Model_Tudu_Extension_Meeting(array('orgid' => $this->_user->orgId, 'notifytime' => $this->_request->getPost('notifytime'), 'notifytype' => $this->_request->getPost('notifytype'), 'location' => $this->_request->getPost('location'), 'isallday' => $this->_request->getPost('isallday')));
         $tudu->setExtension($meeting);
     }
     $params = array(&$tudu);
     try {
         $model->execute('compose', $params);
         // 保存后添加发送操作
         if ($action != self::ACTION_SAVE) {
             $modelSend->send($tudu);
         }
         // 考勤流程
         if ($action == self::ACTION_REVIEW && $tudu->fromTudu->appId == 'attend') {
             $flow = $tudu->getExtension('Model_Tudu_Extension_Flow');
             if ($flow->currentStepId == '^end' || $flow->currentStepId == '^break') {
                 $tudu->stepId = $flow->currentStepId;
                 $mtudu = new Tudu_Model_Tudu_Entity_Tudu($tudu->getAttributes());
                 Tudu_Dao_Manager::setDbs(array(Tudu_Dao_Manager::DB_APP => $this->multidb->getDb('app')));
                 $daoApply = Tudu_Dao_Manager::getDao('Dao_App_Attend_Apply', Tudu_Dao_Manager::DB_APP);
                 $apply = $daoApply->getApply(array('tuduid' => $tudu->tuduId));
                 if (null !== $apply) {
                     $mapply = new Tudu_Model_App_Attend_Tudu_Apply($apply->toArray());
                     $model = new Tudu_Model_App_Attend_Tudu_Extension_Apply();
                     $model->onReview($mtudu, $mapply);
                 }
             }
         }
         // 捕获流程异常返回错误信息
     } catch (Model_Tudu_Exception $e) {
         $error = null;
         switch ($e->getCode()) {
             case Model_Tudu_Exception::TUDU_NOTEXISTS:
                 // 图度不存在
                 $error = $this->lang['tudu_not_exists'];
                 break;
             case Model_Tudu_Exception::BOARD_NOTEXISTS:
                 $error = $this->lang['board_not_exists_or_deny'];
                 break;
             case Model_Tudu_Exception::FLOW_USER_NOT_EXISTS:
                 $error = $this->lang['missing_flow_steps_receiver'];
                 break;
             case Model_Tudu_Exception::FLOW_NOT_EXISTS:
                 $error = $this->lang['missing_flow_steps'];
                 break;
             case Model_Tudu_Exception::INVALID_USER:
             case Model_Tudu_Exception::PERMISSION_DENIED:
                 $error = $this->lang['permission_denied_for_tudu'];
                 break;
             default:
                 $error = $action !== self::ACTION_SAVE ? $this->lang['send_failure'] : $this->lang['save_failure'];
                 if ($action == self::ACTION_REVIEW) {
                     $error = $this->lang['review_failure'];
                 }
                 break;
         }
         $this->json(false, $error);
     }
     $returnData = array('tuduid' => $tudu->tuduId);
     // 返回图度组
     if (null !== ($group = $tudu->getExtension('Model_Tudu_Extension_Group'))) {
         $returnData['children'] = array();
         $children = $group->getChildren();
         foreach ($children as $item) {
             $returnData['children'][] = $item->tuduId;
         }
     }
     $message = $action !== self::ACTION_SAVE ? $this->lang['send_success'] : $this->lang['save_success'];
     $this->json(true, $message, $returnData);
 }
Example #11
0
 /**
  *
  */
 public function _initDb()
 {
     $multidb = $this->bootstrap('multidb');
     Tudu_Dao_Manager::setDbs(array(Tudu_Dao_Manager::DB_MD => $this->multidb->getDb('md')));
 }
Example #12
0
 /**
  * 审批
  */
 public function reviewAction()
 {
     $post = $this->_request->getParams();
     require_once 'Model/Tudu/Tudu.php';
     $tudu = new Model_Tudu_Tudu();
     $this->_formatParams($tudu, $post);
     $tudu->setAttributes(array('orgid' => $this->_user->orgId, 'uniqueid' => $this->_user->uniqueId, 'poster' => $this->_user->trueName, 'isagree' => $this->_request->getParam('agree', true), 'operation' => 'review'));
     try {
         /* @var $modelCompose Model_Tudu_Compose_Forward */
         $modelCompose = Tudu_Model::factory('Model_Tudu_Compose_Review');
         $params = array(&$tudu);
         $modelCompose->execute('compose', $params);
         // 考勤流程
         if ($tudu->fromTudu->appId == 'attend' && $tudu->stepId == '^end') {
             $mtudu = new Tudu_Model_Tudu_Entity_Tudu($tudu->getAttributes());
             Tudu_Dao_Manager::setDbs(array(Tudu_Dao_Manager::DB_APP => $this->_bootstrap->multidb->getDb('app')));
             $daoApply = Tudu_Dao_Manager::getDao('Dao_App_Attend_Apply', Tudu_Dao_Manager::DB_APP);
             $apply = $daoApply->getApply(array('tuduid' => $tudu->tuduId));
             if (null !== $apply) {
                 $mapply = new Tudu_Model_App_Attend_Tudu_Apply($apply->toArray());
                 $model = new Tudu_Model_App_Attend_Tudu_Extension_Apply();
                 $model->onReview($mtudu, $mapply);
             }
         }
         $config = $this->_bootstrap->getOption('httpsqs');
         $tuduconf = $this->_bootstrap->getOption('tudu');
         $sendType = isset($tuduconf['send']) ? ucfirst($tuduconf['send']['class']) : 'Common';
         $sendClass = 'Model_Tudu_Send_' . $sendType;
         $modelSend = new $sendClass(array('httpsqs' => $config));
         $modelSend->send(&$tudu);
         /*$config  = $this->_bootstrap->getOption('httpsqs');
                     $httpsqs = new Oray_Httpsqs($config['host'], $config['port'], $config['chartset'], $config['name']);
         
                     $action = 'review';
                     $sqsParam = array(
                         'tsid'        => $this->_user->tsId,
                         'tuduid'      => $tudu->tuduId,
                         'from'        => $this->_user->userName,
                         'uniqueid'    => $this->_user->uniqueId,
                         'server'      => $this->_request->getServer('HTTP_HOST'),
                         'type'        => $tudu->type,
                         'stepid'      => $tudu->fromTudu->stepId,
                         'stepstatus'  => $tudu->stepId  && $tudu->fromTudu->stepId != $tudu->stepId && 0 !== strpos($tudu->stepId, '^'),
                         'nstepid'     => $tudu->stepId,
                         'flowid'      => $tudu->flowId,
                         'agree'       => $this->_request->getParam('agree', true),
                         'ischangedCc' => ($action == 'update' && $tudu->cc) ? (boolean) $tudu->cc : false
                     );
         
                     $httpsqs->put(implode(' ', array(
                         'tudu',
                         $action,
                         '',
                         http_build_query($sqsParam)
                     )), 'tudu');*/
     } catch (Model_Tudu_Exception $e) {
         throw new TuduX_OpenApi_Exception('Tudu review failed', TuduX_OpenApi_ResponseCode::TUDU_SEND_FAILED);
     }
     $this->view->tuduid = $tudu->tuduId;
     $this->view->code = TuduX_OpenApi_ResponseCode::SUCCESS;
 }
Example #13
0
 /**
  * (non-PHPdoc)
  * @see Zend_Controller_Action::init()
  */
 public function init()
 {
     parent::init();
     $this->_bootstrap = $this->getInvokeArg('bootstrap');
     $accessToken = $this->_request->getParam('access_token', $this->_request->getHeader('OAuth-AccessToken'));
     $memcache = $this->_bootstrap->getResource('memcache');
     Tudu_User::setMemcache($memcache);
     $this->_user = Tudu_User::getInstance();
     // 提供访问令牌
     if (!empty($accessToken)) {
         $storage = new TuduX_OAuth_Storage_Session();
         $storage->setMemcache($memcache);
         $oauth = new OpenApi_OAuth_OAuth(array(OpenApi_OAuth_OAuth::STORAGE => $storage));
         $scope = $this->_request->getParam('client_id', $this->_request->getHeader('OAuth-Scope'));
         try {
             $token = $oauth->verifyAccessToken($accessToken, $scope);
             $this->_user->init($token['auth']);
             // 用户被禁用或已被退出登录
             if (!$this->_user->isLogined()) {
                 $oauth->destroyAccessToken($accessToken);
                 throw new OpenApi_OAuth_Exception("Invalid access token provided", OpenApi_OAuth_OAuth::ERROR_INVALID_ACCESSTOKEN);
             }
             // ts服务器
             $tsServer = 'ts' . $this->_user->tsId;
             Tudu_Dao_Manager::setDbs(array(Tudu_Dao_Manager::DB_TS => $this->_bootstrap->multidb->getDb($tsServer)));
             $this->_clientId = $token[OpenApi_OAuth_OAuth::PARAM_CLIENT_ID];
             $this->_accessToken = $accessToken;
             $this->_token = $token;
             // 验证失败
         } catch (OpenApi_OAuth_Exception $e) {
             throw $e;
         }
     }
 }
Example #14
0
 /**
  * 创建图度组织
  */
 public function createOrg()
 {
     if (empty($this->_orgParams)) {
         require_once 'Tudu/Install/Exception.php';
         throw new Tudu_Install_Exception('empty org params');
     }
     if (empty($this->_configs['mysql'])) {
         require_once 'Tudu/Install/Exception.php';
         throw new Tudu_Install_Exception('empty configs database');
     }
     $this->_configs['mysql'] = array_merge($this->_configs['mysql'], array('charset' => 'utf8'));
     require_once 'Zend/Db.php';
     require_once 'Zend/Db/Exception.php';
     $db = Zend_Db::factory('pdo_mysql', $this->_configs['mysql']);
     require_once 'Tudu/Dao/Manager.php';
     Tudu_Dao_Manager::setDbs(array(Tudu_Dao_Manager::DB_MD => $db, Tudu_Dao_Manager::DB_TS => $db));
     if (!empty($this->_dataPath)) {
         $dataPath = array('data' => array('path' => $this->_dataPath));
         require_once 'Tudu/Model.php';
         require_once 'Tudu/Model/ResourceManager/Registry.php';
         $resourceManager = new Tudu_Model_ResourceManager_Registry();
         $resourceManager->setResource('config', $dataPath);
         Tudu_Model::setResourceManager($resourceManager);
     }
     require_once 'Model/Org/Org.php';
     require_once 'Model/Org/Exception.php';
     /* @var $modelOrg Model_Org_Org */
     $modelOrg = Tudu_Model::factory('Model_Org_Org');
     try {
         $modelOrg->addAction('create', array($modelOrg, 'createAdmin'), 10);
         $modelOrg->addAction('create', array($modelOrg, 'active'), 9);
         $modelOrg->execute('create', array(array('orgid' => $this->_orgParams['orgid'], 'orgname' => $this->_orgParams['orgname'], 'userid' => $this->_orgParams['userid'], 'password' => $this->_orgParams['password'], 'truename' => $this->_orgParams['userid'], 'domain' => $this->_orgParams['domain'])));
     } catch (Model_Org_Exception $e) {
         require_once 'Tudu/Install/Exception.php';
         throw new Tudu_Install_Exception($e->getMessage());
     }
 }