/**
  * get default view.
  *
  * @return Enum
  */
 public function getDefaultView()
 {
     if (!$this->mRoot->mContext->mUser->mIdentity->isAuthenticated()) {
         return $this->_getFrameViewStatus('ERROR');
     }
     $this->mHandler =& Cosmoapi_Utils::getTrustModuleHandler('data', $this->mAsset->mTrustDirname);
     $this->_getId();
     if (!$this->mHandler->setDirname($this->mDirname)) {
         return $this->_getFrameViewStatus('ERROR');
     }
     $this->mObject =& $this->mHandler->get($this->mDataId);
     if (!$this->mObject) {
         return $this->_getFrameViewStatus('ERROR');
     }
     return $this->_getFrameViewStatus('SUCCESS');
 }
 /**
  * get default view.
  *
  * @return Enum
  */
 public function getDefaultView()
 {
     if (!$this->mRoot->mContext->mUser->mIdentity->isAuthenticated()) {
         return $this->_getFrameViewStatus('ERROR');
     }
     $this->mHandler =& Cosmoapi_Utils::getTrustModuleHandler('data', $this->mAsset->mTrustDirname);
     $this->_getId();
     if (!$this->mHandler->setDirname($this->mDirname)) {
         return $this->_getFrameViewStatus('ERROR');
     }
     $req = $this->mRoot->mContext->mRequest;
     $key = $req->getRequest('key');
     $value = $req->getRequest('value');
     $this->mResult = $this->mHandler->update($this->mDataId, $key, $value);
     return $this->_getFrameViewStatus('SUCCESS');
 }
 /**
  * get default view.
  *
  * @return Enum
  */
 public function getDefaultView()
 {
     if (!$this->mRoot->mContext->mUser->mIdentity->isAuthenticated()) {
         return $this->_getFrameViewStatus('ERROR');
     }
     $this->mHandler =& Cosmoapi_Utils::getTrustModuleHandler('data', $this->mAsset->mTrustDirname);
     $this->_getId();
     if (!$this->mHandler->setDirname($this->mDirname)) {
         return $this->_getFrameViewStatus('ERROR');
     }
     $req = $this->mRoot->mContext->mRequest;
     $path = $req->getRequest('path');
     $file = new XCube_FormFile('file');
     $this->mResult = $this->mHandler->upload($this->mDataId, $path, $file);
     return $this->_getFrameViewStatus('SUCCESS');
 }
 /**
  * get default view.
  *
  * @return Enum
  */
 public function getDefaultView()
 {
     if (!$this->mRoot->mContext->mUser->mIdentity->isAuthenticated()) {
         return $this->_getFrameViewStatus('ERROR');
     }
     $this->mHandler =& Cosmoapi_Utils::getTrustModuleHandler('data', $this->mAsset->mTrustDirname);
     $this->_getDirname();
     if (!$this->mHandler->setDirname($this->mDirname)) {
         return $this->_getFrameViewStatus('ERROR');
     }
     $req = $this->mRoot->mContext->mRequest;
     $keyword = '';
     $this->mSearchCriteria['keyword'] = $keyword;
     $this->mDataIds = $this->mHandler->getIds();
     if ($this->mDataIds === false) {
         return $this->_getFrameViewStatus('ERROR');
     }
     return $this->_getFrameViewStatus('SUCCESS');
 }
 /**
  * uninstall blocks.
  */
 private function _uninstallBlocks()
 {
     $dirname = $this->_mXoopsModule->get('dirname');
     $constpref = '_MI_' . strtoupper($dirname);
     Cosmoapi_InstallUtils::uninstallAllOfBlocks($this->_mXoopsModule, $this->mLog);
     $tplHandler =& Cosmoapi_Utils::getXoopsHandler('tplfile');
     $cri = new Criteria('tpl_module', $dirname);
     if (!$tplHandler->deleteAll($cri)) {
         $this->mLog->addError(XCube_Utils::formatString(constant($constpref . '_INSTALL_ERROR_BLOCK_TPL_DELETED'), $tplHandler->db->error()));
     }
 }
 /**
  * create permission.
  *
  * @param int $gid
  *
  * @return XoopsGroupPerm&
  */
 private function &_createPermission($gid)
 {
     $gpermHandler =& Cosmoapi_Utils::getXoopsHandler('groupperm');
     $perm =& $gpermHandler->create();
     $perm->set('gperm_groupid', $gid);
     $perm->set('gperm_itemid', $this->_mXoopsModule->get('mid'));
     $perm->set('gperm_modid', 1);
     return $perm;
 }
 /**
  * update config order by info.
  *
  * @param Legacy_PreferenceInformation &$info
  * @param XoopsModule                  &$module
  * @param Legacy_ModuleInstallLog      &$log
  *
  * @return bool
  */
 public static function updateConfigOrderByInfo(&$info, &$module, &$log)
 {
     $dirname = $module->get('dirname');
     $constpref = '_MI_' . strtoupper($dirname);
     $configHandler =& Cosmoapi_Utils::getXoopsHandler('config');
     $cri = new CriteriaCompo();
     $cri->add(new Criteria('conf_modid', $module->get('mid')));
     $cri->add(new Criteria('conf_catid', 0));
     $cri->add(new Criteria('conf_name', $info->mName));
     $configs =& $configHandler->getConfigs($cri);
     if (!(count($configs) > 0 && is_object($configs[0]))) {
         $log->addError(constant($constpref . '_INSTALL_ERROR_CONFIG_NOT_FOUND'));
         return false;
     }
     $config =& $configs[0];
     $config->set('conf_order', $info->mOrder);
     if (!$configHandler->insertConfig($config)) {
         $log->addError(XCube_Utils::formatString(constant($constpref . '_INSTALL_ERROR_CONFIG_UPDATED'), $config->get('conf_name')));
         return false;
     }
     return true;
 }
 public function update($dataId, $key, $value)
 {
     $compHandler =& Cosmoapi_Utils::getTrustModuleHandler('component', COSMOAPI_TRUST_DIRNAME);
     $compHandler->setDirname($this->mDirname);
     return $compHandler->update($dataId, $key, $value);
 }
 /**
  * save xoops module.
  *
  * @param XoopsModule &$module
  */
 public function saveXoopsModule(&$module)
 {
     $dirname = $module->get('dirname');
     $constpref = '_MI_' . strtoupper($dirname);
     $moduleHandler =& Cosmoapi_Utils::getXoopsHandler('module');
     if ($moduleHandler->insert($module)) {
         $this->mLog->addReport(constant($constpref . '_INSTALL_MSG_UPDATE_FINISHED'));
     } else {
         $this->mLog->addError(constant($constpref . '_INSTALL_ERROR_UPDATE_FINISHED'));
     }
 }