当前位置: 首页>>代码示例>>PHP>>正文


PHP CriteriaCompo类代码示例

本文整理汇总了PHP中CriteriaCompo的典型用法代码示例。如果您正苦于以下问题:PHP CriteriaCompo类的具体用法?PHP CriteriaCompo怎么用?PHP CriteriaCompo使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了CriteriaCompo类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: smarty_function_xoInboxCount

function smarty_function_xoInboxCount($params, &$smarty)
{
    global $xoopsUser;
    if (!isset($xoopsUser) || !is_object($xoopsUser)) {
        return;
    }
    $time = time();
    if (isset($_SESSION['xoops_inbox_count']) && @$_SESSION['xoops_inbox_count_expire'] > $time) {
        $count = intval($_SESSION['xoops_inbox_count']);
    } else {
        $module_handler = xoops_gethandler('module');
        $pm_module = $module_handler->getByDirname('pm');
        if ($pm_module && $pm_module->getVar('isactive')) {
            $pm_handler =& xoops_getModuleHandler('message', 'pm');
        } else {
            $pm_handler =& xoops_gethandler('privmessage');
        }
        $criteria = new CriteriaCompo(new Criteria('read_msg', 0));
        $criteria->add(new Criteria('to_userid', $xoopsUser->getVar('uid')));
        $count = intval($pm_handler->getCount($criteria));
        $_SESSION['xoops_inbox_count'] = $count;
        $_SESSION['xoops_inbox_count_expire'] = $time + 60;
    }
    if (!@empty($params['assign'])) {
        $smarty->assign($params['assign'], $count);
    } else {
        echo $count;
    }
}
开发者ID:yunsite,项目名称:xoopsdc,代码行数:29,代码来源:function.xoInboxCount.php

示例2: getCategoryList

 public function getCategoryList($uid = 0)
 {
     $criteria = new CriteriaCompo();
     if (!empty($uid)) {
         $criteria->add(new Criteria("uid", $uid));
     }
     $criteria->setOrder("ASC");
     $criteria->setSort("cat_id");
     $categories = $this->getAll($criteria);
     $catarr = array();
     if ($this->getCount($criteria)) {
         unset($criteria);
         $topic_handler = xoops_getmodulehandler("topics", "press");
         $criteria = new CriteriaCompo(new Criteria("cat_id", "(" . implode(",", array_keys($categories)) . ")", "in"));
         if (!empty($uid)) {
             $criteria->add(new Criteria("uid", $uid));
         }
         $criteria->setGroupby("cat_id");
         $counts = $topic_handler->getCounts($criteria);
         foreach ($categories as $key => $obj) {
             $catarr[$key]["cat_name"] = $obj->getVar("cat_name");
             $catarr[$key]["cat_id"] = $key;
             if (!empty($uid)) {
                 $catarr[$key]["uid"] = $uid;
             }
             $catarr[$key]["cat_topics"] = isset($counts[$key]) ? $counts[$key] : 0;
         }
         return $catarr;
     }
 }
开发者ID:yunsite,项目名称:xoopsdc,代码行数:30,代码来源:category.php

示例3: smarty_function_xoInboxCount

function smarty_function_xoInboxCount($params, &$smarty)
{
    $xoops = Xoops::getInstance();
    if (!$xoops->isUser()) {
        return;
    }
    $time = time();
    if (isset($_SESSION['xoops_inbox_count']) && @$_SESSION['xoops_inbox_count_expire'] > $time) {
        $count = (int) $_SESSION['xoops_inbox_count'];
    } else {
        $pm_handler = $xoops->getHandlerPrivateMessage();
        $xoopsPreload = XoopsPreload::getInstance();
        $xoopsPreload->triggerEvent('core.class.smarty.xoops_plugins.xoinboxcount', array($pm_handler));
        $criteria = new CriteriaCompo(new Criteria('read_msg', 0));
        $criteria->add(new Criteria('to_userid', $xoops->user->getVar('uid')));
        $count = (int) $pm_handler->getCount($criteria);
        $_SESSION['xoops_inbox_count'] = $count;
        $_SESSION['xoops_inbox_count_expire'] = $time + 60;
    }
    if (!@empty($params['assign'])) {
        $smarty->assign($params['assign'], $count);
    } else {
        echo $count;
    }
}
开发者ID:ming-hai,项目名称:XoopsCore,代码行数:25,代码来源:function.xoInboxCount.php

示例4: b_categories_list_show

function b_categories_list_show($options)
{
    include_once XOOPS_ROOT_PATH . "/modules/smartpartner/include/common.php";
    $smartpartner_category_handler =& smartpartner_gethandler('category');
    $criteria = new CriteriaCompo();
    $criteria->setSort(isset($options[0]) ? $options[0] : 'name');
    $criteria->setOrder(isset($options[1]) ? $options[1] : 'ASC');
    $catsObj =& $smartpartner_category_handler->getobjects($criteria, true);
    $catArray = get_content(0, $catsObj, $options[2]);
    $block = array();
    $block['categories'] = $catArray;
    $block['displaysubs'] = $options[2];
    if (isset($_GET['view_category_id'])) {
        $current_id = $_GET['view_category_id'];
        $block['current'] = $catsObj[$current_id]->getVar('parentid') == 0 ? $current_id : $catsObj[$current_id]->getVar('parentid');
    } elseif (isset($_GET['id'])) {
        $smartpartner_partner_handler =& smartpartner_gethandler('partner');
        $partnerObj = $smartpartner_partner_handler->get($_GET['id']);
        if (is_object($partnerObj)) {
            $parent = $partnerObj->getVar('categoryid');
            $block['current'] = $catsObj[$parent]->getVar('parentid') == 0 ? $parent : $catsObj[$parent]->getVar('parentid');
        }
    }
    return $block;
}
开发者ID:trabisdementia,项目名称:xuups,代码行数:25,代码来源:categories_list.php

示例5: _updatePassword

 function _updatePassword(&$controller)
 {
     $this->mActionForm->fetch();
     $userHandler =& xoops_gethandler('user');
     $criteria = new CriteriaCompo(new Criteria('email', $this->mActionForm->get('email')));
     $criteria->add(new Criteria('pass', $this->mActionForm->get('code'), '=', '', 'LEFT(%s, 5)'));
     $lostUserArr =& $userHandler->getObjects($criteria);
     if (is_array($lostUserArr) && count($lostUserArr) > 0) {
         $lostUser =& $lostUserArr[0];
     } else {
         return USER_FRAME_VIEW_ERROR;
     }
     $newpass = xoops_makepass();
     $extraVars['newpass'] = $newpass;
     $builder = new User_LostPass2MailBuilder();
     $director = new User_LostPassMailDirector($builder, $lostUser, $controller->mRoot->mContext->getXoopsConfig(), $extraVars);
     $director->contruct();
     $xoopsMailer =& $builder->getResult();
     if (!$xoopsMailer->send()) {
         // $xoopsMailer->getErrors();
         return USER_FRAME_VIEW_ERROR;
     }
     $lostUser->set('pass', md5($newpass), true);
     $userHandler->insert($lostUser, true);
     return USER_FRAME_VIEW_SUCCESS;
 }
开发者ID:nouphet,项目名称:rata,代码行数:26,代码来源:LostPassAction.class.php

示例6: xoops_module_update_ckeditor4

function xoops_module_update_ckeditor4()
{
    $module_handler = xoops_gethandler('module');
    $Module = $module_handler->getByDirname('ckeditor4');
    $config_handler = xoops_gethandler('config');
    $mid = $Module->mid();
    $ModuleConfig = $config_handler->getConfigsByCat(0, $mid);
    if (substr($ModuleConfig['toolbar_user'], -4) === '""]]') {
        //fix typo '""]]' to '"]]' for version <= 0.37
        $criteria = new CriteriaCompo(new Criteria('conf_modid', $mid));
        $criteria->add(new Criteria('conf_catid', 0));
        $criteria->add(new Criteria('conf_name', 'toolbar_user'));
        if ($configs = $config_handler->_cHandler->getObjects($criteria)) {
            $val = str_replace('""]]', '"]]', $ModuleConfig['toolbar_user']);
            $configs[0]->setVar('conf_value', $val, true);
            $config_handler->insertConfig($configs[0]);
        }
    }
    if (preg_match('/^head\\s*$/m', $ModuleConfig['contentsCss'])) {
        //fix typo 'head' to '<head>' for version <= 0.38
        $criteria = new CriteriaCompo(new Criteria('conf_modid', $mid));
        $criteria->add(new Criteria('conf_catid', 0));
        $criteria->add(new Criteria('conf_name', 'contentsCss'));
        if ($configs = $config_handler->_cHandler->getObjects($criteria)) {
            $val = preg_replace('/^head(\\s*)$/m', '<head>$1', $ModuleConfig['contentsCss']);
            $configs[0]->setVar('conf_value', $val, true);
            $config_handler->insertConfig($configs[0]);
        }
    }
    return true;
}
开发者ID:digideskio,项目名称:ckeditor4,代码行数:31,代码来源:onupdate.inc.php

示例7: getGrantedGroupsForIds

 function getGrantedGroupsForIds($item_ids_array, $gperm_name = false)
 {
     static $groups;
     if ($gperm_name) {
         if (isset($groups[$gperm_name])) {
             return $groups[$gperm_name];
         }
     } else {
         // if !$gperm_name then we will fetch all permissions in the module so we don't need them again
         return $groups;
     }
     $criteria = new CriteriaCompo();
     $criteria->add(new Criteria('gperm_modid', $this->mid));
     if ($gperm_name) {
         $criteria->add(new Criteria('gperm_name', $gperm_name));
     }
     $objs = $this->getObjects($criteria);
     foreach ($objs as $obj) {
         $groups[$obj->getVar('gperm_name')][$obj->getVar('gperm_itemid')][] = $obj->getVar('gperm_groupid');
     }
     //Return the permission array
     if ($gperm_name) {
         return isset($groups[$gperm_name]) ? $groups[$gperm_name] : array();
     } else {
         return isset($groups) ? $groups : array();
     }
 }
开发者ID:trabisdementia,项目名称:xuups,代码行数:27,代码来源:Permission.php

示例8: checkLogin

 function checkLogin(&$xoopsUser)
 {
     $root =& XCube_Root::getSingleton();
     if ($root->mContext->mUser->isInRole('Site.RegisteredUser')) {
         return;
     }
     $root->mLanguageManager->loadModuleMessageCatalog('user');
     $userHandler =& xoops_getmodulehandler('users', 'user');
     $criteria = new CriteriaCompo();
     if (xoops_getrequest('uname') != "" && strpos(xoops_getrequest('uname'), '@') !== false) {
         $criteria->add(new Criteria('email', xoops_getrequest('uname')));
     } else {
         $criteria->add(new Criteria('uname', xoops_getrequest('uname')));
         // use for both e-mail or uname logiin
         //	$criteria->add(new Criteria('uname',''));				// use for only e-mail logiin
     }
     $criteria->add(new Criteria('pass', md5(xoops_getrequest('pass'))));
     $userArr =& $userHandler->getObjects($criteria);
     if (count($userArr) != 1) {
         return;
     }
     if ($userArr[0]->get('level') == 0) {
         return;
     }
     $handler =& xoops_gethandler('user');
     $user =& $handler->get($userArr[0]->get('uid'));
     $xoopsUser = $user;
     require_once XOOPS_ROOT_PATH . '/include/session.php';
     xoops_session_regenerate();
     $_SESSION = array();
     $_SESSION['xoopsUserId'] = $xoopsUser->get('uid');
     $_SESSION['xoopsUserGroups'] = $xoopsUser->getGroups();
 }
开发者ID:nouphet,项目名称:rata,代码行数:33,代码来源:Emaillogin.class.php

示例9: executeViewIndex

 function executeViewIndex(&$controller, &$xoopsUser, &$render)
 {
     $render->setTemplateName("blockinstall_list.html");
     //
     // Lazy load
     //
     foreach (array_keys($this->mObjects) as $key) {
         $this->mObjects[$key]->loadModule();
     }
     $render->setAttribute("objects", $this->mObjects);
     $render->setAttribute("pageNavi", $this->mFilter->mNavi);
     $moduleHandler =& xoops_gethandler('module');
     $modules =& $moduleHandler->getObjects(new Criteria('isactive', 1));
     $render->setAttribute('modules', $modules);
     $render->setAttribute('filterForm', $this->mFilter);
     $render->setAttribute('pageArr', $this->mpageArr);
     $block_handler =& $this->_getHandler();
     $block_total = $block_handler->getCount();
     $inactive_block_total = $block_handler->getCount(new Criteria('isactive', 0));
     $active_block_total = $block_total - $inactive_block_total;
     $render->setAttribute('BlockTotal', $block_total);
     $render->setAttribute('ActiveBlockTotal', $active_block_total);
     $render->setAttribute('InactiveBlockTotal', $inactive_block_total);
     $active_installed_criteria = new CriteriaCompo(new Criteria('visible', 1));
     $active_installed_criteria->add(new Criteria('isactive', 1));
     $active_installed_block_total = $block_handler->getCount($active_installed_criteria);
     $render->setAttribute('ActiveInstalledBlockTotal', $active_installed_block_total);
     $render->setAttribute('ActiveUninstalledBlockTotal', $active_block_total - $active_installed_block_total);
     $inactive_installed_criteria = new CriteriaCompo(new Criteria('visible', 1));
     $inactive_installed_criteria->add(new Criteria('isactive', 0));
     $inactive_installed_block_total = $block_handler->getCount($inactive_installed_criteria);
     $render->setAttribute('InactiveInstalledBlockTotal', $inactive_installed_block_total);
     $render->setAttribute('InactiveUninstalledBlockTotal', $inactive_block_total - $inactive_installed_block_total);
 }
开发者ID:nunoluciano,项目名称:uxcl,代码行数:34,代码来源:BlockInstallListAction.class.php

示例10: getTabTitle

 function getTabTitle()
 {
     $title = $this->getVar('tabtitle');
     // PM detection and conversion
     if (preg_match('/{pm_new}/i', $title) || preg_match('/{pm_readed}/i', $title) || preg_match('/{pm_total}/i', $title)) {
         if (is_object($GLOBALS['xoopsUser'])) {
             $new_messages = 0;
             $old_messages = 0;
             $som = 0;
             $user_id = 0;
             $user_id = $GLOBALS['xoopsUser']->getVar('uid');
             $pm_handler =& xoops_gethandler('privmessage');
             $criteria_new = new CriteriaCompo(new Criteria('read_msg', 0));
             $criteria_new->add(new Criteria('to_userid', $GLOBALS['xoopsUser']->getVar('uid')));
             $new_messages = $pm_handler->getCount($criteria_new);
             $criteria_old = new CriteriaCompo(new Criteria('read_msg', 1));
             $criteria_old->add(new Criteria('to_userid', $GLOBALS['xoopsUser']->getVar('uid')));
             $old_messages = $pm_handler->getCount($criteria_old);
             $som = $old_messages + $new_messages;
             if ($new_messages > 0) {
                 $title = preg_replace('/\\{pm_new\\}/', '(<span style="color: rgb(255, 0, 0); font-weight: bold;">' . $new_messages . '</span>)', $title);
             }
             if ($old_messages > 0) {
                 $title = preg_replace('/\\{pm_readed\\}/', '(<span style="color: rgb(255, 0, 0); font-weight: bold;">' . $old_messages . '</span>)', $title);
             }
             if ($old_messages > 0) {
                 $title = preg_replace('/\\{pm_total\\}/', '(<span style="color: rgb(255, 0, 0); font-weight: bold;">' . $som . '</span>)', $title);
             }
         }
         $title = preg_replace('/\\{pm_new\\}/', '', $title);
         $title = preg_replace('/\\{pm_readed\\}/', '', $title);
         $title = preg_replace('/\\{pm_total\\}/', '', $title);
     }
     return trim($title);
 }
开发者ID:trabisdementia,项目名称:xuups,代码行数:35,代码来源:tab.php

示例11: userPosts

 /**
  * @param int $uid
  *
  * @return int
  */
 public function userPosts($uid)
 {
     $criteria = new CriteriaCompo();
     $criteria->add(new Criteria('content_status', 0, '!='));
     $criteria->add(new Criteria('content_author', (int) $uid));
     return \Xoops::getModuleHelper('page')->getContentHandler()->getCount($criteria);
 }
开发者ID:ming-hai,项目名称:XoopsCore,代码行数:12,代码来源:system.php

示例12: prepare

 /**
  * prepare
  * 
  * @param   void
  * 
  * @return  bool
  **/
 public function prepare()
 {
     parent::prepare();
     // in case of NEW post
     if ($this->mObject->isNew()) {
         if ($this->mRoot->mContext->mUser->isInRole('Site.RegisteredUser')) {
             $this->mObject->set('uid', $this->mRoot->mContext->mXoopsUser->get('uid'));
         }
         $this->mObject->set('post_time', time());
         $this->mObject->set('modified_time', time());
         $this->mObject->set('uid_hidden', 0);
         $this->mObject->set('poster_ip', addslashes(@$_SERVER['REMOTE_ADDR']));
         $this->mObject->set('modifier_ip', addslashes(@$_SERVER['REMOTE_ADDR']));
         // get pid --> is it response post?
         $pid = (int) $this->mRoot->mContext->mRequest->getRequest('pid');
         if (isset($pid) && $pid > 0) {
             $this->mObject->set('pid', $pid);
             $topic_id = (int) $this->mRoot->mContext->mRequest->getRequest('topic_id');
             $mParentHandler =& $this->_getHandler();
             $criteria = new CriteriaCompo();
             $criteria->add(new Criteria('post_id', $pid));
             $mGotObjects =& $mParentHandler->getObjects($criteria, true);
             $this->mParentObj =& $mGotObjects[0];
             // get parent object --> is it really response post?
             if (is_object($this->mParentObj)) {
                 $this->mObject->set('topic_id', $this->mParentObj->get('topic_id'));
                 $this->mObject->set('subject', "Re: " . ltrim($this->mParentObj->get('subject'), 'Re: '));
                 $this->mObject->set('depth_in_tree', (int) $this->mParentObj->get('depth_in_tree') + 1);
             }
         }
         //adump($pid,$topic_id);
         //adump($this->mParentObj);
     }
     return true;
 }
开发者ID:naao,项目名称:xcforum_proto,代码行数:42,代码来源:PostsEditAction.class.php

示例13: CriteriaCompo

    function &getList($avatar_type = null, $avatar_display = null)
    {
        $criteria = new CriteriaCompo();
        if (isset($avatar_type)) {
            $avatar_type = ($avatar_type == 'C') ? 'C' : 'S';
            $criteria->add(new Criteria('avatar_type', $avatar_type));
        }
        if (isset($avatar_display)) {
            $criteria->add(new Criteria('avatar_display', intval($avatar_display)));
        }
        $avatars =& $this->getObjects($criteria, true);
        $ret = array();
        $ret[] = array(
        	'id' => 0,
        	'name' => _NONE,
        	'file' => 'blank.gif',
        );
        if(is_array($avatars)){
	        foreach ($avatars as $id => $obj) {
	            $ret[] = array(
	            	'id' => $id,
	            	'name' => $obj->getVar('avatar_name'),
	            	'file' => $obj->getVar('avatar_file'),
	            );
	        }
        }
        return $ret;
    }
开发者ID:nunoluciano,项目名称:uxcl,代码行数:28,代码来源:avatar.class.php

示例14: dispatch

function dispatch()
{
	global $xoopsUser;
	if($this->isGuest()){
		redirect_header(XOOPS_URL, 2, _NOPERM);
	}
	
	$uid_from = $xoopsUser->getVar('uid');
	$uid_to = $this->getIntRequest('uid', XSNS_REQUEST_GET);
	$user_handler =& XsnsUserHandler::getInstance();
	$user_to =& $user_handler->get($uid_to);
	if(!is_object($user_to) || !$user_to->isFriend($uid_from)){
		redirect_header(XOOPS_URL, 2, _NOPERM);
	}
	
	$criteria = new CriteriaCompo(new Criteria('uid_to', $uid_to));
	$criteria->add(new Criteria('uid_from', $uid_from));
	$intro_handler =& XsnsIntroductionHandler::getInstance();
	$intro_obj_list =& $intro_handler->getObjects($criteria);
	if(is_array($intro_obj_list) && count($intro_obj_list)>0){
		$body = $intro_obj_list[0]->getVar('body', 'e');
	}
	else{
		$body = "";
	}
	
	$this->context->setAttribute('uid_to', $uid_to);
	$this->context->setAttribute('body', $body);
	$this->context->setAttribute('user_menu', $user_to->getMypageMenu());
	$this->context->setAttribute('user_name', $user_to->getVar('uname'));
}
开发者ID:nunoluciano,项目名称:uxcl,代码行数:31,代码来源:intro_addAction.php

示例15: makeKeywordCriteria

 public static function makeKeywordCriteria(CriteriaCompo $cri, $dirname, $keywords, $andor = 'AND')
 {
     $handler = Legacy_Utils::getModuleHandler('definition', $dirname);
     //keywords
     $keywordArr = self::splitKeywords($keywords);
     //definition
     $cri->add(new Criteria('search_flag', 1));
     $cri->add(new Criteria('field_type', array(Xcck_FieldType::STRING, Xcck_FieldType::TEXT, Xcck_FieldType::URI), 'IN'));
     $defObjs = $handler->getObjects($cri);
     foreach ($defObjs as $obj) {
         $fieldList['field_name'][] = $obj->get('field_name');
         $fieldList['field_type'][] = $obj->get('field_type');
     }
     //page
     $cri = new CriteriaCompo();
     foreach ($defObjs as $def) {
         foreach ($keywordArr as $keyword) {
             if (strtoupper($andor) === 'OR') {
                 $cri->add(new Criteria($def->get('field_name'), self::makeKeyword($keyword), 'LIKE'), 'OR');
             } else {
                 $cri->add(new Criteria($def->get('field_name'), self::makeKeyword($keyword), 'LIKE'));
             }
         }
     }
     return $cri;
 }
开发者ID:mambax7,项目名称:xcck,代码行数:26,代码来源:Search.class.php


注:本文中的CriteriaCompo类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。