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


PHP CriteriaCompo::add方法代码示例

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


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

示例1: 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

示例2: 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

示例3: 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 Page::getInstance()->getContentHandler()->getCount($criteria);
 }
开发者ID:RanLee,项目名称:XoopsCore,代码行数:12,代码来源:system.php

示例4: 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

示例5: get_system_main_menu_show

function get_system_main_menu_show()
{
    global $xoopsUser, $xoopsModule;
    $block = array();
    $block['lang_home'] = _MB_SYSTEM_HOME;
    $block['lang_close'] = _CLOSE;
    $module_handler =& xoops_gethandler('module');
    $criteria = new CriteriaCompo(new Criteria('hasmain', 1));
    $criteria->add(new Criteria('isactive', 1));
    $criteria->add(new Criteria('weight', 0, '>'));
    $modules = $module_handler->getObjects($criteria, true);
    $moduleperm_handler =& xoops_gethandler('groupperm');
    $groups = is_object($xoopsUser) ? $xoopsUser->getGroups() : XOOPS_GROUP_ANONYMOUS;
    $read_allowed = $moduleperm_handler->getItemIds('module_read', $groups);
    foreach (array_keys($modules) as $i) {
        if (in_array($i, $read_allowed)) {
            $block['modules'][$i]['name'] = $modules[$i]->getVar('name');
            $block['modules'][$i]['directory'] = $modules[$i]->getVar('dirname');
            $sublinks = $modules[$i]->subLink();
            if (count($sublinks) > 0) {
                foreach ($sublinks as $sublink) {
                    $block['modules'][$i]['sublinks'][] = array('name' => $sublink['name'], 'url' => XOOPS_URL . '/modules/' . $modules[$i]->getVar('dirname') . '/' . $sublink['url']);
                }
            } else {
                $block['modules'][$i]['sublinks'] = array();
            }
        }
    }
    return $block;
}
开发者ID:yunsite,项目名称:xoopsdc,代码行数:30,代码来源:ex_assign.php

示例6: checkRight

 function checkRight($gperm_name, $gperm_itemid, $gperm_groupid, $gperm_modid = 1)
 {
     //ver3.0 by domifara
     if (isset($this->gpermission[$gperm_name]) && isset($this->gpermission[$gperm_name][$gperm_itemid]) && isset($this->gpermission[$gperm_name][$gperm_itemid][serialize($gperm_groupid)]) && isset($this->gpermission[$gperm_name][$gperm_itemid][serialize($gperm_groupid)][$gperm_modid])) {
         return $this->gpermission[$gperm_name][$gperm_itemid][serialize($gperm_groupid)][$gperm_modid];
     }
     $criteria = new CriteriaCompo(new Criteria('gperm_modid', $gperm_modid));
     $criteria->add(new Criteria('gperm_name', $gperm_name));
     $gperm_itemid = intval($gperm_itemid);
     if ($gperm_itemid > 0) {
         $criteria->add(new Criteria('gperm_itemid', $gperm_itemid));
     }
     if (is_array($gperm_groupid)) {
         $criteria2 = new CriteriaCompo();
         foreach ($gperm_groupid as $key => $gid) {
             $criteria2->add(new Criteria('gperm_groupid', $gid), 'OR');
         }
         $criteria->add($criteria2);
     } else {
         $criteria->add(new Criteria('gperm_groupid', $gperm_groupid));
     }
     $ret = false;
     if ($this->getCount($criteria) > 0) {
         $ret = true;
     }
     $this->gpermission[$gperm_name][$gperm_itemid][serialize($gperm_groupid)][$gperm_modid] = $ret;
     return $ret;
 }
开发者ID:nouphet,项目名称:rata,代码行数:28,代码来源:bulletingp.php

示例7: about_block_page_edit

function about_block_page_edit($options)
{
    @(include dirname(dirname(__FILE__)) . "/xoops_version.php");
    $page_handler =& xoops_getmodulehandler('page', 'about');
    $criteria = new CriteriaCompo();
    $criteria->add(new Criteria('page_status', 1), 'AND');
    $criteria->add(new Criteria('page_type', 1));
    $criteria->setSort('page_order');
    $criteria->setOrder('ASC');
    $fields = array("page_id", "page_title", "page_image");
    $pages = $page_handler->getAll($criteria, $fields, false);
    $page_title = '';
    foreach ($pages as $k => $v) {
        $page_title = '<a href="' . XOOPS_URL . '/modules/' . $modversion['dirname'] . '/index.php?page_id=' . $k . '" target="_blank">' . $v['page_title'] . '</a>';
        $options_page[$k] = empty($v['page_image']) ? $page_title : $page_title . '<img src="' . XOOPS_URL . '/modules/' . $modversion['dirname'] . '/images/picture.png' . '" />';
    }
    include_once dirname(dirname(__FILE__)) . '/include/xoopsformloader.php';
    $form = new XoopsBlockForm();
    $page_select = new XoopsFormRadio(_MI_ABOUT_BLOCKPAGE, 'options[0]', $options[0], '<br />');
    $page_select->addOptionArray($options_page);
    $form->addElement($page_select);
    $form->addElement(new XoopsFormText(_MI_ABOUT_TEXT_LENGTH, 'options[1]', 5, 5, $options[1]));
    $form->addElement(new XoopsFormText(_MI_ABOUT_VIEW_MORELINKTEXT, 'options[2]', 30, 50, $options[2]));
    $form->addElement(new XoopsFormRadioYN(_MI_ABOUT_DOTITLEIMAGE, 'options[3]', $options[3]));
    return $form->render();
}
开发者ID:yunsite,项目名称:xoopsdc,代码行数:26,代码来源:blocks.php

示例8: CriteriaCompo

	function &getModule()
	{
		global $xoopsUser;
		$ret = NULL;
		
		if(empty($this->module_dirname) || empty($this->user_blog_url)){
			return $ret;
		}
		
		$criteria = new CriteriaCompo(new Criteria('hassearch', 1));
		$criteria->add(new Criteria('isactive', 1));
		$criteria->add(new Criteria('dirname', $this->module_dirname));
		$module_handler =& xoops_gethandler('module');
		$blog_module_list =& $module_handler->getList($criteria);
		if(count($blog_module_list) != 1){
			return $ret;
		}
		
		$blog_module =& $module_handler->getByDirName($this->module_dirname);
		if(!is_object($blog_module) || strtolower(get_class($blog_module))!='xoopsmodule'){
			return $ret;
		}
		
		$gperm_handler =& xoops_gethandler('groupperm');
		$groups = is_object($xoopsUser)? $xoopsUser->getGroups() : XOOPS_GROUP_ANONYMOUS;
		
		if($gperm_handler->checkRight('module_read', $blog_module->getVar('mid'), $groups)) {
			$ret =& $blog_module;
		}
		return $ret;
	}
开发者ID:nunoluciano,项目名称:uxcl,代码行数:31,代码来源:blog_module.php

示例9: 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

示例10: publisher_date_to_date_show

function publisher_date_to_date_show($options)
{
    $myts = MyTextSanitizer::getInstance();
    $publisher = PublisherPublisher::getInstance();
    $block = array();
    $criteria = new CriteriaCompo();
    $criteria->add(new Criteria('datesub', strtotime($options[0]), '>'));
    $criteria->add(new Criteria('datesub', strtotime($options[1]), '<'));
    $criteria->setSort('datesub');
    $criteria->setOrder('DESC');
    // creating the ITEM objects that belong to the selected category
    $itemsObj = $publisher->getHandler('item')->getObjects($criteria);
    $totalItems = count($itemsObj);
    if ($itemsObj) {
        for ($i = 0; $i < $totalItems; $i++) {
            $newItems['itemid'] = $itemsObj[$i]->itemid();
            $newItems['title'] = $itemsObj[$i]->title();
            $newItems['categoryname'] = $itemsObj[$i]->getCategoryName();
            $newItems['categoryid'] = $itemsObj[$i]->categoryid();
            $newItems['date'] = $itemsObj[$i]->datesub();
            $newItems['poster'] = $itemsObj[$i]->linkedPosterName();
            $newItems['itemlink'] = $itemsObj[$i]->getItemLink(false, isset($options[3]) ? $options[3] : 65);
            $newItems['categorylink'] = $itemsObj[$i]->getCategoryLink();
            $block['items'][] = $newItems;
        }
        $block['lang_title'] = _MB_PUBLISHER_ITEMS;
        $block['lang_category'] = _MB_PUBLISHER_CATEGORY;
        $block['lang_poster'] = _MB_PUBLISHER_POSTEDBY;
        $block['lang_date'] = _MB_PUBLISHER_DATE;
        $modulename = $myts->displayTarea($publisher->getModule()->getVar('name'));
        $block['lang_visitItem'] = _MB_PUBLISHER_VISITITEM . " " . $modulename;
        $block['lang_articles_from_to'] = sprintf(_MB_PUBLISHER_ARTICLES_FROM_TO, $options[0], $options[1]);
    }
    return $block;
}
开发者ID:trabisdementia,项目名称:xuups,代码行数:35,代码来源:date_to_date.php

示例11: xoopsfaq_search

/**
 * xoopsfaq_search()
 *
 * @param mixed $queryarray
 * @param mixed $andor
 * @param mixed $limit
 * @param mixed $offset
 * @param mixed $userid
 * @return
 */
function xoopsfaq_search($queryarray, $andor, $limit, $offset, $userid)
{
    global $xoopsDB;
    $ret = array();
    if ($userid != 0) {
        return $ret;
    }
    $xfDir = basename(dirname(dirname(__FILE__)));
    $xfContentsHandler =& xoops_getmodulehandler('contents', $xfDir);
    $contentFields = array('contents_id', 'contents_cid', 'contents_title', 'contents_contents', 'contents_publish');
    $criteria = new CriteriaCompo();
    $criteria->add(new Criteria('contents_active', 1, '='));
    $criteria->setSort('contents_id');
    $criteria->setOrder('DESC');
    $criteria->setLimit(intval($limit));
    $criteria->setStart(intval($offset));
    if (is_array($queryarray) && !empty($queryarray)) {
        $criteria->add(new Criteria('contents_title', "%{$queryarray[0]}%", 'LIKE'));
        $criteria->add(new Criteria('contents_contents', "%{$queryarray[0]}%", 'LIKE'), 'OR');
        array_shift($queryarray);
        //get rid of first element
        foreach ($queryarray as $query) {
            $criteria->add(new Criteria('contents_title', "%{$query}%", 'LIKE'), $andor);
            $criteria->add(new Criteria('contents_contents', "%{$query}%", 'LIKE'), 'OR');
        }
    }
    $contentArray = $xfContentsHandler->getAll($criteria, $contentFields, false);
    foreach ($contentArray as $content) {
        $ret[] = array('image' => 'images/question2.gif', 'link' => "index.php?cat_id=" . $content['contents_cid'] . "#" . $content['contents_id'], 'title' => $content['contents_title'], 'time' => $content['contents_publish']);
    }
    unset($contentArray);
    return $ret;
}
开发者ID:BackupTheBerlios,项目名称:haxoo-svn,代码行数:43,代码来源:search.inc.php

示例12: update_block_permissions

function update_block_permissions($old_gid, $new_gid)
{
    // get handlers
    $gperm_handler =& xoops_gethandler('groupperm');
    $module_handler =& xoops_gethandler('module');
    $module =& $module_handler->getByDirname('xoonips');
    $mid = $module->getVar('mid');
    $block_objs =& XoopsBlock::getByModule($mid);
    foreach ($block_objs as $block_obj) {
        // find moderator menu block
        if ($block_obj->getVar('show_func') == 'b_xoonips_moderator_show') {
            $bid = $block_obj->getVar('bid');
            // if old_gid don't have module admin right,
            // delete the right to access from old_gid.
            if (!$gperm_handler->checkRight('module_admin', $mid, $old_gid)) {
                $criteria = new CriteriaCompo();
                $criteria->add(new Criteria('gperm_groupid', $old_gid));
                $criteria->add(new Criteria('gperm_itemid', $bid));
                $criteria->add(new Criteria('gperm_name', 'block_read'));
                $gperm_handler->deleteAll($criteria);
            }
            // if there is no right to access moderator block in new_gid,
            // the right gives new_gid.
            if (!$gperm_handler->checkRight('block_read', $bid, $new_gid)) {
                $gperm_handler->addRight('block_read', $bid, $new_gid);
            }
            break;
        }
    }
}
开发者ID:XoopsModules25x,项目名称:xcl-module-xoonips,代码行数:30,代码来源:system_basic_update.php

示例13: 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

示例14: getGrantedGroupsForIds

 function getGrantedGroupsForIds($item_ids_array, $gperm_name = false)
 {
     static $groups;
     static $smartsection_all_permissions_fetched;
     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
         if ($smartsection_all_permissions_fetched) {
             return $groups;
         } else {
             $smartsection_all_permissions_fetched = true;
         }
     }
     $smartModule =& smartsection_getModuleInfo();
     $criteria = new CriteriaCompo();
     $criteria->add(new Criteria('gperm_modid', $smartModule->getVar('mid')));
     if ($gperm_name) {
         $criteria->add(new Criteria('gperm_name', $gperm_name));
     }
     //Get group permissions handler
     $gperm_handler =& xoops_gethandler('groupperm');
     $permissionsObj = $gperm_handler->getObjects($criteria);
     foreach ($permissionsObj as $permissionObj) {
         $groups[$permissionObj->getVar('gperm_name')][$permissionObj->getVar('gperm_itemid')][] = $permissionObj->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:severnaya99,项目名称:Sg-2010,代码行数:35,代码来源:permission.php

示例15: xoops_module_update_search

/**
 * XXX
 *
 * @copyright       XOOPS Project (http://xoops.org)
 * @license         GNU GPL 2 or later (http://www.gnu.org/licenses/gpl-2.0.html)
 * @since           2.6.0
 * @author          Mage Grégory (AKA Mage)
 * @version         $Id: $
 */
function xoops_module_update_search(XoopsModule &$module)
{
    $xoops = Xoops::getInstance();
    // Copy old configs in new configs and delete old configs
    $config_handler = $xoops->getHandlerConfig();
    $criteria = new CriteriaCompo();
    $criteria->add(new Criteria('conf_modid', 0));
    $criteria->add(new Criteria('conf_catid', 5));
    $configs = $config_handler->getConfigs($criteria);
    $confcount = count($configs);
    if ($confcount > 0) {
        for ($i = 0; $i < $confcount; ++$i) {
            $criteria = new CriteriaCompo();
            $criteria->add(new Criteria('conf_modid', $module->getVar('mid')));
            $criteria->add(new Criteria('conf_name', $configs[$i]->getvar('conf_name')));
            $new_configs = $config_handler->getConfigs($criteria);
            $new_confcount = count($new_configs);
            if ($new_confcount > 0) {
                for ($j = 0; $j < $new_confcount; ++$j) {
                    $obj = $config_handler->getConfig($new_configs[$j]->getvar('conf_id'));
                }
                $obj->setVar("conf_value", $configs[$i]->getvar('conf_value'));
                $config_handler->insertConfig($obj);
                $config_handler->deleteConfig($configs[$i]);
            }
        }
    }
    return true;
}
开发者ID:RanLee,项目名称:XoopsCore,代码行数:38,代码来源:update.php


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