/**
  * preprare
  * 
  * @param   void
  * 
  * @return  bool
  **/
 public function prepare()
 {
     $this->mPermit = Legacy_Utils::getModuleHandler('permit', $this->mAsset->mDirname)->create();
     //for Permissions
     $this->mPermit->set('cat_id', 0);
     $this->_setupActionForm();
 }
 /**
  * prepare
  *
  * @param	void
  *
  * @return	bool
  **/
 public function prepare()
 {
     parent::prepare();
     $topic_id = (int) $this->mRoot->mContext->mRequest->getRequest('topic_id');
     $handler =& $this->mAsset->getObject('handler', 'Posts', false);
     //$handler = Legacy_Utils::getModuleHandler('posts', $this->mAsset->mDirname);
     $criteria = new criteriacompo();
     $criteria->add(new criteria('topic_id', $topic_id));
     $criteria->addSort('post_time', 'ASC');
     // TODO: other sorts
     $this->mPostsObj = $handler->getObjects($criteria);
     if (is_object($this->mObject)) {
         $this->forum_id = (int) $this->mObject->get('forum_id');
         $handler = Legacy_Utils::getModuleHandler('forums', $this->mAsset->mDirname);
         $this->mForumObj = $handler->get($this->forum_id);
         //adump($this->mForumObj);
         $this->ext_link_id = $this->mObject->get('topic_external_link_id');
         //adump($external_link_id);
         if ($this->ext_link_id > 0) {
             $mExtHandler =& $this->mAsset->getObject('handler', 'Topics', false);
             $criteria = new criteriacompo();
             $criteria->add(new criteria('topic_external_link_id', $this->ext_link_id));
             $this->mTopics_ExtObj = $mExtHandler->getObjects($criteria);
         }
         //adump($this->mTopics_ExtObj);
         return true;
     }
     return false;
 }
 /**
  * executeViewInput
  * 
  * @param	XCube_RenderTarget	&$render
  * 
  * @return	void
  **/
 public function executeViewSuccess(&$render)
 {
     $render->setTemplateName('order_show.html');
     $render->setAttribute('dirname', $this->mAsset->mDirname);
     $render->setAttribute('definitions', Legacy_Utils::getModuleHandler('definition', $this->mAsset->mDirname)->getFields());
     $render->setAttribute('xcckConfigs', $this->mRoot->mContext->mModuleConfig);
 }
Exemple #4
0
 /**
  * loadLink
  * 
  * @param	void
  * 
  * @return	void
  */
 public function loadLink()
 {
     if ($this->_mLinkLoadedFlag == false) {
         $handler = Legacy_Utils::getModuleHandler('link', $this->getDirname());
         $this->mLink =& $handler->get($this->get('link_id'));
         $this->_mLinkLoadedFlag = true;
     }
 }
	/**
	 * @public
	 */
	function executeViewIndex(&$render)
	{
		$render->setTemplateName("profile_data_list.html");
		$render->setAttribute('objects', $this->mObjects);
		$render->setAttribute('pageNavi', $this->mFilter->mNavi);
		$handler = Legacy_Utils::getModuleHandler('definitions', 'profile');
		$render->setAttribute('definitions', $handler->getFields4DataShow(Legacy_Utils::getUid()));
	}
Exemple #6
0
 /**
  * loadRpg
  * 
  * @param	void
  * 
  * @return	void
  */
 public function loadRpg()
 {
     if ($this->_mRpgLoadedFlag == false) {
         $handler = Legacy_Utils::getModuleHandler('rpg', TRPG_DIRNAME);
         $this->mRpg =& $handler->get($this->get('rpg_id'));
         $this->_mRpgLoadedFlag = true;
     }
 }
 /**
  * getDataIdListByTags
  *
  * @param int[]		$list
  * @param string	$tDirname	//Legacy_Tag module's dirname
  * @param string[]	$tagArr
  * @param string	$dirname
  * @param string	$dataname
  */
 public static function getDataIdListByTags(&$list, $tDirname, $tagArr, $dirname, $dataname)
 {
     if (count($tagArr) === 0) {
         return;
     }
     $handler = Legacy_Utils::getModuleHandler('tag', $tDirname);
     $list = $handler->getDataIdListByTags($tagArr, $dirname, $dataname);
 }
Exemple #8
0
 /**
  * loadGroup
  * 
  * @param	void
  * 
  * @return	void
  */
 public function loadGroup()
 {
     if ($this->_mGroupLoadedFlag == false) {
         $handler = Legacy_Utils::getModuleHandler('group', $this->getDirname());
         $this->mGroup =& $handler->get($this->get('group_id'));
         $this->_mGroupLoadedFlag = true;
     }
 }
 /**
  * prepare
  * 
  * @param    void
  * 
  * @return    bool
  **/
 public function prepare()
 {
     parent::prepare();
     if (!($this->mGroup = Legacy_Utils::getModuleHandler('group', $this->mAsset->mDirname)->get($this->_getGroupId()))) {
         $this->mRoot->mController->executeRedirect($this->_getNextUri('group'), 1, _MD_LEGROUP_ERROR_INVALID_GROUP);
     }
     return true;
 }
 /**
  * _setupObject
  *
  * @param	void
  *
  * @return	void
  **/
 protected function _setupObject()
 {
     $id = $this->_getId();
     $this->mObjectHandler =& $this->_getHandler();
     $revisionHandler = Legacy_Utils::getModuleHandler('revision', $this->mAsset->mDirname);
     $revision = $revisionHandler->getLatestRevision($id, Lenum_Status::REJECTED);
     $this->mObject = Xcck_Utils::setupPageByRevision($revision);
 }
Exemple #11
0
 /**
  * loadFriend
  * 
  * @param	void
  * 
  * @return	void
  */
 public function loadFriend()
 {
     if ($this->_mFriendLoadedFlag == false) {
         $handler = Legacy_Utils::getModuleHandler('player', $this->getDirname());
         $this->mFriend =& $handler->get($this->get('conne_uid'));
         $this->_mFriendLoadedFlag = true;
     }
 }
 /**
  * executeViewInput
  * 
  * @param	XCube_RenderTarget	&$render
  * 
  * @return	void
  **/
 public function executeViewInput(&$render)
 {
     $render->setTemplateName($this->mAsset->mDirname . '_conv_edit.html');
     $render->setAttribute('actionForm', $this->mActionForm);
     $render->setAttribute('object', $this->mObject);
     $render->setAttribute('Pref_idTree', $this->mCategoryManager['pref_id']->getTree(Playermap_CategoryManager::VIEW));
     $myGroupIds = Legacy_Utils::getModuleHandler('member', $this->mAsset->mDirname)->getMyGroupIdList();
     $render->setAttribute('myGroups', Legacy_Utils::getModuleHandler('group', $this->mAsset->mDirname)->getGroupListByIds($myGroupIds));
 }
 /**
  * getImageObjects
  *
  * @param Legacy_AbstractImageObject[]	&$objects
  * @param string	$dirname
  * @param string	$dataname
  * @param int		$dataId
  * @param int		$num
  * @param int		$limit
  * @param int		$start
  *
  * @return	void
  */
 public static function getImageObjects(&$objects, $dirname, $dataname, $dataId = 0, $num = 0, $limit = 10, $start = 0)
 {
     XCube_Root::getSingleton()->mLanguageManager->loadModuleMessageCatalog(LEGACY_IMAGE_DIRNAME);
     $handler = Legacy_Utils::getModuleHandler('image', LEGACY_IMAGE_DIRNAME);
     $images = $handler->getImageObjects($dirname, $dataname, $dataId, $num, $limit, $start);
     foreach ($images as $image) {
         $objects[$image->getShow('num')] = $image;
     }
 }
Exemple #14
0
 /**
  * @public
  */
 public function Profile_DataObject()
 {
     $handler = Legacy_Utils::getModuleHandler('definitions', 'profile');
     $this->mDef = $handler->getDefinitions(false);
     $this->initVar('uid', XOBJ_DTYPE_INT, '', false);
     foreach (array_keys($this->mDef) as $key) {
         $this->mDef[$key]->mFieldType->setInitVar($this, $this->mDef[$key]->getShow('field_name'), $this->mDef[$key]->getDefault());
     }
 }
Exemple #15
0
 /**
  * _getCategoryFields
  * 
  * @param   void
  * 
  * @return  int[]
  **/
 protected function _getCategoryFields()
 {
     $catObjs = Legacy_Utils::getModuleHandler('definition', $this->mAsset->mDirname)->getObjects(new Criteria('field_type', Xcck_FieldType::CATEGORY));
     foreach ($catObjs as $cat) {
         if (!$cat->get('options')) {
             unset($cat);
         }
     }
     return $catObjs;
 }
 /**
  *	@public
  */
 public function createBlogModule(&$module, &$log)
 {
     $handler = Legacy_Utils::getModuleHandler('definition', $dirname);
     $arr = self::_getFieldSetting();
     foreach ($arr as $field) {
         $obj = $handler->create();
         self::_setupObject($obj, $field);
         $handler->insert($obj, true);
     }
 }
Exemple #17
0
 public function updateStatus($pageId, $status)
 {
     $obj = $this->getLatestRevision($pageId);
     if (!$obj instanceof Xcck_RevisionObject) {
         return false;
     }
     $obj->set('status', $status);
     $handler = Legacy_Utils::getModuleHandler('page', $this->getDirname());
     $page = Xcck_Utils::setupPageByRevision($obj);
     return $handler->insert($page, true);
 }
 /**
  * getDefaultView
  * 
  * @param    void
  * 
  * @return    Enum
  **/
 public function getDefaultView()
 {
     $this->mFilter =& $this->_getFilterForm();
     $this->mFilter->fetch();
     $mHandler = Legacy_Utils::getModuleHandler('member', $this->mAsset->mDirname);
     $ids = $mHandler->getMyGroupIdList();
     $handler =& $this->_getHandler();
     $cri = $this->mFilter->getCriteria();
     $cri->add(new Criteria('group_id', $ids, 'IN'));
     $this->mObjects =& $handler->getObjects($cri);
     return LEGROUP_FRAME_VIEW_INDEX;
 }
 /**
  * getNormalUri
  *
  * @param string	$uri
  * @param string	$dirname
  * @param string	$dataname
  * @param int		$data_id
  * @param string	$action
  * @param string	$query
  *
  * @return	void
  */
 public function getNormalUri(&$uri, $dirname, $dataname = null, $data_id = 0, $action = null, $query = null)
 {
     $sUri = '/%s/index.php?action=%s%s';
     $lUri = '/%s/index.php?action=%s%s&%s=%d';
     switch ($dataname) {
         case null:
         case 'player':
             $key = 'uid';
             break;
         case 'circle':
             $key = 'group_id';
             break;
         default:
             $key = $dataname . '_id';
             break;
     }
     $table = isset($dataname) ? $dataname : 'player';
     if (isset($dataname)) {
         if ($data_id > 0) {
             if (isset($action)) {
                 $uri = sprintf($lUri, $dirname, ucfirst($dataname), ucfirst($action), $key, $data_id);
             } else {
                 $uri = sprintf($lUri, $dirname, ucfirst($dataname), 'View', $key, $data_id);
             }
         } else {
             if (isset($action)) {
                 $uri = sprintf($sUri, $dirname, ucfirst($dataname), ucfirst($action));
             } else {
                 $uri = sprintf($sUri, $dirname, ucfirst($dataname), 'List');
             }
         }
         $uri = isset($query) ? $uri . '&' . $query : $uri;
     } else {
         if ($data_id > 0) {
             if (isset($action)) {
                 die;
             } else {
                 $handler = Legacy_Utils::getModuleHandler($table, $dirname);
                 $key = $handler->mPrimary;
                 $uri = sprintf($lUri, $dirname, ucfirst($table), 'View', $key, $data_id);
             }
             $uri = isset($query) ? $uri . '&' . $query : $uri;
         } else {
             if (isset($action)) {
                 die;
             } else {
                 $uri = sprintf('/%s/', $dirname);
                 $uri = isset($query) ? $uri . 'index.php?' . $query : $uri;
             }
         }
     }
 }
 /**
  * prepare
  * 
  * @param	void
  * 
  * @return	bool
  **/
 public function prepare()
 {
     parent::prepare();
     $topic_id = (int) $this->mRoot->mContext->mRequest->getRequest('topic_id');
     $handler = Legacy_Utils::getModuleHandler('topics', $this->mAsset->mDirname);
     $this->mTopicObj = $handler->getObjects($topic_id);
     //adump($this->mTopicObj);
     $forum_id = $this->mTopicObj->getShow('forum_id');
     $handler = Legacy_Utils::getModuleHandler('forums', $this->mAsset->mDirname);
     $this->mForumObj = $handler->get($forum_id);
     //adump($this->mForumObj);
     // TODO: CATEGORY AND FORUM PERMISSION
     return true;
 }
Exemple #21
0
 public static function searchKeyword($dirname, $keywords, $andor = 'AND', $limit = null, $offset = null, $uid = null)
 {
     $cri = Xcck_Utils::getListCriteria($dirname);
     $cri = self::makeKeywordCriteria($cri, $dirname, $keywords, $andor);
     if ((int) $uid > 0) {
         $cri->add(new Criteria('uid', $uid));
     }
     $handler = Legacy_Utils::getModuleHandler('page', $dirname);
     $pageObjs = $handler->getObjects($cri, $limit, $offset);
     foreach ($pageObjs as $page) {
         $ret[] = array('link' => "index.php?page_id=" . $page->getShow('page_id'), 'title' => $page->getShow('title'), 'time' => $page->get('posttime'), 'uid' => $uid, "context" => '');
     }
     return $ret;
 }
Exemple #22
0
 /**
  * getClientData
  * 
  * @param	array	$list
  *  $client['template_name']
  *  $client['data']
  *  $client['dirname']
  * @param	array	$client
  *  $client['dirname']
  *  $client['dataname']
  * 
  * @return	mixed[]
  *	string	$list['template_name'][]
  *	string	$list['data'][]
  **/
 public function getClientData($list, $client)
 {
     $handler = Legacy_Utils::getModuleHandler('tag', $this->getDirname());
     $cri = new CriteriaCompo();
     $cri->add(new Criteria('tag', $this->get('tag')));
     $cri->add(new Criteria('dirname', $client['dirname']));
     $cri->add(new Criteria('dataname', $client['dataname']));
     $cri->setSort('posttime', 'DESC');
     $objs = $handler->getObjects($cri);
     $idList = array();
     foreach ($objs as $obj) {
         $idList[] = $obj->get('data_id');
     }
     XCube_DelegateUtils::call('Legacy_TagClient.' . $client['dirname'] . '.GetClientData', new XCube_Ref($list), $client['dirname'], $client['dataname'], $idList);
     return $list;
 }
 /**
  * prepare
  * 
  * @param    void
  * 
  * @return    bool
  **/
 public function prepare()
 {
     if (!($this->mGroup = Legacy_Utils::getModuleHandler('group', $this->mAsset->mDirname)->get($this->_getGroupId()))) {
         $this->mRoot->mController->executeRedirect($this->_getNextUri('group'), 1, _MD_LEGROUP_ERROR_INVALID_GROUP);
     }
     parent::prepare();
     if ($this->mObject->isNew()) {
         //group_id is required
         if (!($groupId = $this->_getGroupId())) {
             $this->mRoot->mController->executeRedirect($this->_getNextUri('group', 'list'), 1, _MD_LEGROUP_ERROR_NO_GROUP_ID);
         }
         $this->mObject->set('group_id', $groupId);
         $this->mObject->set('status', Lenum_WorkflowStatus::FINISHED);
         $this->mObject->set('rank', Lenum_GroupRank::REGULAR);
     }
     return true;
 }
 /**
  * fetch
  * 
  * @param   string    $dirname
  * 
  * @return  void
  **/
 public function fetch($dirname)
 {
     $this->mNavi->fetch();
     $this->fetchSort();
     $this->mHandler = Legacy_Utils::getModuleHandler('definition', $dirname);
     $request = XCube_Root::getSingleton()->mContext->mRequest;
     if (($catId = $request->getRequest('category_id')) !== null) {
         $this->mNavi->addExtra('category_id', (int) $catId);
     }
     //get child category's data ?
     $child = false;
     if ($request->getRequest('child') === "all") {
         $child = true;
     } elseif ($request->getRequest('child') === "single") {
         $child = false;
     }
     $this->_mCriteria = Xcck_Utils::getListCriteria($dirname, (int) $catId, $child, $this->mSort, Lenum_Status::PUBLISHED);
     //Search previously defined fields
     $definedFields = array('name' => array('page_id', 'title', 'uid', 'maintable_id', 'posttime', 'updatetime'), 'type' => array(Xcck_FieldType::INT, Xcck_FieldType::STRING, Xcck_FieldType::INT, Xcck_FieldType::INT, Xcck_FieldType::DATE, Xcck_FieldType::DATE));
     foreach (array_keys($definedFields['name']) as $key) {
         if ($value = $request->getRequest($definedFields['name'][$key]) !== null) {
             $this->_setDefinedFieldRequest($definedFields['name'][$key], $definedFields['type'][$key], $value);
         }
     }
     //Search User defined fields
     foreach ($this->mDefinitions as $definition) {
         if ($value = $request->getRequest($definition->get('field_name')) !== null) {
             $value = $request->getRequest($definition->get('field_name'));
             $this->_setRequest($definition, $value);
         }
     }
     //Search by keyword: search all string and text field
     if (($value = $request->getRequest('keyword')) !== null) {
         $this->mNavi->addExtra('keywords', $value);
         Xcck_SearchUtils::makeKeywordCriteria($this->_mCriteria, $dirname, $value);
     }
     if (($value = $request->getRequest('child')) !== null) {
         $this->mNavi->addExtra('child', $value);
     }
     //filter by tag
     if (($tags = $request->getRequest('tag')) !== null) {
         $this->_setTagRequest($tags, $dirname);
     }
     XCube_DelegateUtils::call('Module.' . $dirname . '.FetchSearchFilter', $this);
 }
 /**
  * getNormalUri
  *
  * @param string	$uri
  * @param string	$dirname
  * @param string	$dataname
  * @param int		$data_id
  * @param string	$action
  * @param string	$query
  *
  * @return	void
  */
 public function getNormalUri(&$uri, $dirname, $dataname = null, $data_id = 0, $action = null, $query = null)
 {
     $sUri = '/%s/index.php?action=%s%s';
     $lUri = '/%s/index.php?action=%s%s&%s=%d';
     $table = isset($dataname) ? $dataname : 'link';
     $key = $table . '_id';
     if (isset($dataname)) {
         if ($data_id > 0) {
             if (isset($action)) {
                 $uri = sprintf($lUri, $dirname, ucfirst($dataname), ucfirst($action), $key, $data_id);
             } else {
                 $uri = sprintf($lUri, $dirname, ucfirst($dataname), 'View', $key, $data_id);
             }
         } else {
             if (isset($action)) {
                 $uri = sprintf($sUri, $dirname, ucfirst($dataname), ucfirst($action));
             } else {
                 $uri = sprintf($sUri, $dirname, ucfirst($dataname), 'List');
             }
         }
         $uri = isset($query) ? $uri . '&' . $query : $uri;
     } else {
         if ($data_id > 0) {
             if (isset($action)) {
                 die;
             } else {
                 $handler = Legacy_Utils::getModuleHandler($table, $dirname);
                 $key = $handler->mPrimary;
                 $uri = sprintf($lUri, $dirname, ucfirst($table) . 'View', ucfirst($action), $key, $data_id);
             }
             $uri = isset($query) ? $uri . '&' . $query : $uri;
         } else {
             if (isset($action)) {
                 die;
             } else {
                 $uri = sprintf('/%s/', $dirname);
                 $uri = isset($query) ? $uri . 'index.php?' . $query : $uri;
             }
         }
     }
 }
Exemple #26
0
function smarty_modifier_xoops_user($uid, $key, $flag = 2)
{
    require_once XOOPS_MODULE_PATH . '/profile/class/handler/Definitions.class.php';
    $handler = xoops_gethandler('member');
    $user = $handler->getUser(intval($uid));
    if (in_array($key, Profile_DefinitionsHandler::getReservedNameList())) {
        if ($key == 'user_name') {
            return Legacy_Utils::getUserName($uid);
        }
        if (is_object($user) && $user->isActive()) {
            return $flag == 2 ? $user->getShow($key) : $user->get($key);
        }
    } else {
        $profileHandler = Legacy_Utils::getModuleHandler('data', 'profile');
        $profile = $profileHandler->get($uid);
        if (is_object($profile) && is_object($user) && $user->isActive()) {
            return $profile->showField($key, $flag);
        }
    }
    return null;
}
 /**
  * execute
  * 
  * @param	void
  * 
  * @return	Enum
  **/
 public function execute()
 {
     $thumbnailArr = $this->_createThumbnailArray();
     $handler = Legacy_Utils::getModuleHandler('thumbnail', LEGACY_IMAGEMANAGER_DIRNAME);
     //check thumbnail settings
     $cri = new CriteriaCompo();
     $cri->add(new Criteria('dirname', 'playermap'));
     if (count($handler->getObjects($cri)) > 0) {
         exit;
     }
     //insert thumbnail settings
     foreach ($thumbnailArr as $thumb) {
         $object = $handler->create();
         $object->set('dirname', $thumb['dirname']);
         $object->set('dataname', $thumb['dataname']);
         $object->set('max_width', $thumb['max_width']);
         $object->set('max_height', $thumb['max_height']);
         $object->set('file_type', $thumb['file_type']);
         $object->set('tsize', $thumb['tsize']);
         $handler->insert($object, true);
     }
 }
Exemple #28
0
 function update081()
 {
     $this->mLog->addReport(_AD_LEGACY_MESSAGE_UPDATE_STARTED);
     $dirname = $this->_mCurrentXoopsModule->get('dirname');
     $root = XCube_Root::getSingleton();
     $db = $root->mController->getDB();
     $handler = Legacy_Utils::getModuleHandler('definition', $dirname);
     $revisionHandler = Legacy_Utils::getModuleHandler('revision', $dirname);
     $pageHandler = Legacy_Utils::getModuleHandler('page', $dirname);
     //prepare revision table
     $sql = "DESC `" . $db->prefix($dirname . '_revision') . "` ";
     if (!($result = $db->query($sql))) {
         $this->mLog->addReport($db->error());
     }
     while ($row = $db->fetchArray($result)) {
         $revisionFields[] = $row['Field'];
     }
     $definitions = $handler->getObjects();
     foreach ($definitions as $definition) {
         $fieldType = $definition->get('field_type');
         if (!in_array($definition->get('field_name'), $revisionFields)) {
             $fieldType = $definition->getFieldType();
             $sql = 'ALTER TABLE %s ADD `' . $definition->get('field_name') . '` ' . $fieldType->getTableQuery($definition->get('field_type'));
             $db->query(sprintf($sql, $db->prefix($dirname . '_revision')));
         }
     }
     //copy revision data from page
     if ($revisionHandler->getCount(new Criteria('1', '1')) == 0) {
         $pageObjs = $pageHandler->getObjects();
         foreach ($pageObjs as $page) {
             $revision = Xcck_Utils::setupRevisionByPage($page);
             if (!$revisionHandler->insert($revision, true)) {
                 $this->mLog->addReport($db->error());
             }
         }
     }
     $this->_mCurrentVersion = $this->_mTargetVersion;
     return $this->executeAutomaticUpgrade();
 }
 /**
  * getClientData
  *
  * @param mixed     &$list
  * @param string    $dirname
  * @param string    $dataname
  * @param int[]     $idList
  *
  * @return  void
  */
 public static function getClientData(&$list, $dirname, $dataname, $idList)
 {
     //default
     $limit = 5;
     $start = 0;
     $handler = Legacy_Utils::getModuleHandler($dataname, $dirname);
     if (!$handler) {
         return;
     }
     //setup client module info
     $cri = Xupdatemaster_Utils::getListCriteria($dirname);
     $cri->add(new Criteria($handler->mPrimary, $idList, 'IN'));
     $objs = $handler->getObjects($cri, $limit, $start);
     if (count($objs) > 0) {
         $list['dirname'][] = $dirname;
         $list['dataname'][] = $dataname;
         $list['data'][] = $objs;
         $handler = xoops_gethandler('module');
         $module = $handler->getByDirname($dirname);
         $list['title'][] = $module->name();
         $list['template_name'][] = 'db:' . $dirname . '_' . $dataname . '_inc_view.html';
     }
 }
Exemple #30
0
 /**
  * delete
  * 
  * @param	XoopsSimpleObject	&$obj
  * @param	bool	$force
  * 
  * @return	bool
  **/
 public function delete(&$obj, $force = false)
 {
     $result = parent::delete($obj, $force);
     $handler = Legacy_Utils::getModuleHandler('permission', $this->getDirname());
     $cri = new CriteriaCompo();
     $cri->set('uid', $obj->get('uid'));
     $cri->set('group_id', $obj->get('group_id'));
     $handler->deleteAll($cri);
     return $result;
 }