本文整理汇总了PHP中icms_db_criteria_Compo类的典型用法代码示例。如果您正苦于以下问题:PHP icms_db_criteria_Compo类的具体用法?PHP icms_db_criteria_Compo怎么用?PHP icms_db_criteria_Compo使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了icms_db_criteria_Compo类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getPicturesCriteria
/**
* Create the criteria that will be used by getPictures and getPicturesCount
*
* @param int $start to which record to start
* @param int $limit limit of pictures to return
* @param int $uid_owner if specifid, only the pictures of this user will be returned
* @param int $picture_id ID of a single picture to retrieve
* @return icms_db_criteria_Compo $criteria
*/
private function getPicturesCriteria($start = 0, $limit = 0, $uid_owner = false, $picture_id = false)
{
$module = icms::handler("icms_module")->getByDirname(basename(dirname(dirname(__FILE__))), TRUE);
$criteria = new icms_db_criteria_Compo();
if ($start) {
$criteria->setStart((int) $start);
}
if ($limit) {
$criteria->setLimit((int) $limit);
}
$criteria->setSort('creation_time');
if ($module->config['images_order']) {
$criteria->setOrder('DESC');
}
if (is_object(icms::$user)) {
if (icms::$user->getVar('uid') != $uid_owner && !icms::$user->isAdmin()) {
$criteria->add(new icms_db_criteria_Item('private', 0));
}
} else {
$criteria->add(new icms_db_criteria_Item('private', 0));
}
if ($uid_owner) {
$criteria->add(new icms_db_criteria_Item('uid_owner', (int) $uid_owner));
}
if ($picture_id) {
$criteria->add(new icms_db_criteria_Item('pictures_id', (int) $picture_id));
}
return $criteria;
}
示例2: getAllCategoriesArray
/**
* Return all categories in an array
*
* @param int $parentid
* @param string $perm_name
* @param string $sort
* @param string $order
* @return array
*/
public function getAllCategoriesArray($parentid = 0, $perm_name = false, $sort = 'parentid', $order = 'ASC')
{
if (!$this->allCategoriesObj) {
$criteria = new icms_db_criteria_Compo();
$criteria->setSort($sort);
$criteria->setOrder($order);
$userIsAdmin = is_object(icms::$user) && icms::$user->isAdmin();
if ($perm_name && !$userIsAdmin) {
if (!$this->setGrantedObjectsCriteria($criteria, $perm_name)) {
return false;
}
}
$this->allCategoriesObj =& $this->getObjects($criteria, 'parentid');
}
$ret = array();
if (isset($this->allCategoriesObj[$parentid])) {
foreach ($this->allCategoriesObj[$parentid] as $categoryid => $categoryObj) {
$ret[$categoryid]['self'] =& $categoryObj->toArray();
if (isset($this->allCategoriesObj[$categoryid])) {
$ret[$categoryid]['sub'] =& $this->getAllCategoriesArray($categoryid);
$ret[$categoryid]['subcatscount'] = count($ret[$categoryid]['sub']);
}
}
}
return $ret;
}
示例3: getGrantedGroupsForIds
/**
*
* @param arr $item_ids_array
* @param str $gperm_name
*/
public 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;
}
$icmsModule =& $this->handler->getModuleInfo();
$criteria = new icms_db_criteria_Compo();
$criteria->add(new icms_db_criteria_Item('gperm_modid', $icmsModule->getVar('mid')));
if ($gperm_name) {
$criteria->add(new icms_db_criteria_Item('gperm_name', $gperm_name));
}
//Get group permissions handler
$gperm_handler = icms::handler('icms_member_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();
}
}
示例4: eventStartOutputInit
/**
* Function to be triggered at the end of the core boot process
*
* @return void
*/
function eventStartOutputInit() {
global $xoopsTpl;
if (is_object(icms::$user)) {
foreach (icms::$user->vars as $key => $value) {
$user[$key] = $value;
}
foreach ($user as $key => $value) {
foreach ($user [$key] as $key1 => $value1) {
if ($key1 == 'value') {
if ($key == 'last_login') {
$value1 = formatTimestamp(
isset($_SESSION['xoopsUserLastLogin'])
? $_SESSION['xoopsUserLastLogin']
: time(),
_DATESTRING
);
}
$user [$key] = $value1;
}
}
}
$pm_handler = icms::handler('icms_data_privmessage');
$criteria = new icms_db_criteria_Compo(new icms_db_criteria_Item('read_msg', 0));
$criteria->add(new icms_db_criteria_Item('to_userid', icms::$user->getVar('uid')));
$user['new_messages'] = $pm_handler->getCount($criteria);
$xoopsTpl->assign('user', $user);
}
}
示例5: b_profile_usermenu_show
function b_profile_usermenu_show($options)
{
global $icmsConfigUser;
if (!is_object(icms::$user)) {
return;
}
icms_loadLanguageFile(basename(dirname(dirname(__FILE__))), 'modinfo');
$block = array();
$dirname = basename(dirname(dirname(__FILE__)));
$config_handler = icms::handler('icms_config');
$privmessage_handler = icms::handler('icms_data_privmessage');
$module = icms::handler('icms_module')->getByDirname($dirname, TRUE);
$criteria = new icms_db_criteria_Compo();
$criteria->add(new icms_db_criteria_Item('read_msg', 0));
$criteria->add(new icms_db_criteria_Item('to_userid', icms::$user->getVar('uid')));
$newmsg = $privmessage_handler->getCount($criteria);
$i = 0;
if (icms::$user->isAdmin()) {
$block[++$i]['name'] = _MB_SYSTEM_ADMENU;
$block[$i]['url'] = ICMS_URL . "/admin.php";
}
$block[++$i]['name'] = _MB_SYSTEM_VACNT;
$block[$i]['url'] = ICMS_URL . "/modules/" . $dirname . "/" . ($module->config['profile_social'] ? "index.php?uid=" . icms::$user->getVar('uid') : "userinfo.php?uid=" . icms::$user->getVar('uid'));
$block[++$i]['name'] = _MB_SYSTEM_INBOX;
$block[$i]['url'] = ICMS_URL . "/viewpmsg.php";
$block[$i]['extra'] = $newmsg;
$block[++$i]['name'] = _MB_SYSTEM_NOTIF;
$block[$i]['url'] = ICMS_URL . "/notifications.php";
if ($module->config['profile_social']) {
$block[++$i]['name'] = _MI_PROFILE_SEARCH;
$block[$i]['url'] = ICMS_URL . "/modules/" . $dirname . "/search.php";
}
$block[++$i]['name'] = _MI_PROFILE_EDITACCOUNT;
$block[$i]['url'] = ICMS_URL . "/modules/" . $dirname . "/edituser.php";
$block[++$i]['name'] = _MI_PROFILE_CHANGEPASS;
$block[$i]['url'] = ICMS_URL . "/modules/" . $dirname . "/changepass.php";
if ($icmsConfigUser['allow_chgmail']) {
$block[++$i]['name'] = _MI_PROFILE_CHANGEMAIL;
$block[$i]['url'] = ICMS_URL . "/modules/" . $dirname . "/changemail.php";
}
if ($icmsConfigUser['self_delete']) {
$block[++$i]['name'] = _MI_PROFILE_DELETEACCOUNT;
$block[$i]['url'] = ICMS_URL . "/modules/" . $dirname . "/edituser.php?op=delete";
}
if ($module->config['profile_social']) {
$block[++$i]['name'] = _MI_PROFILE_MYCONFIGS;
$block[$i]['url'] = ICMS_URL . "/modules/" . $dirname . "/configs.php";
}
$block[++$i]['name'] = _MB_SYSTEM_LOUT;
$block[$i]['url'] = ICMS_URL . "/user.php?op=logout";
return $block;
}
示例6: getVisibleFields
/**
* Get fields visible to the $user_groups on a $profile_groups profile
*
* @param array $user_groups
* @param array $profile_groups
* @return array
*/
public function getVisibleFields($user_groups, $profile_groups)
{
$profile_groups[] = 0;
$user_groups[] = 0;
$rtn = array();
$criteria = new icms_db_criteria_Compo();
$criteria->add(new icms_db_criteria_Item('profile_group', '(' . implode(',', $profile_groups) . ')', 'IN'));
$criteria->add(new icms_db_criteria_Item('user_group', '(' . implode(',', $user_groups) . ')', 'IN'));
$visibilities = $this->getObjects($criteria);
foreach ($visibilities as $visibility) {
$rtn[] = $visibility->getVar('fieldid');
}
return array_unique($rtn);
}
示例7: getPluginsArray
/**
* Get an array of plugins
* @param string $path
* @return multitype:
*/
public function getPluginsArray($path)
{
$module_handler = icms::handler('icms_module');
$criteria = new icms_db_criteria_Compo();
$criteria->add(new icms_db_criteria_Item('isactive', 1));
$tempModulesObj = $module_handler->getObjects($criteria);
$modulesObj = array();
foreach ($tempModulesObj as $moduleObj) {
$modulesObj[$moduleObj->getVar('dirname')] = $moduleObj;
}
$aFiles = str_replace('.php', '', icms_core_Filesystem::getFileList(ICMS_ROOT_PATH . '/plugins/' . $path . '/', '', array('php')));
$ret = array();
foreach ($aFiles as $pluginName) {
$module_xoops_version_file = ICMS_ROOT_PATH . "/modules/{$pluginName}/xoops_version.php";
$module_icms_version_file = ICMS_ROOT_PATH . "/modules/{$pluginName}/icms_version.php";
if ((file_exists($module_xoops_version_file) || file_exists($module_icms_version_file)) && isset($modulesObj[$pluginName])) {
$ret[$pluginName] = $modulesObj[$pluginName]->getVar('name');
}
}
return $ret;
}
示例8: __construct
/**
* Constructor
* @param object $object reference to targetobject (@link icms_ipf_Object)
* @param string $key the form name
*/
public function __construct($object, $key)
{
$category_title_field = $object->handler->identifierName;
$addNoParent = isset($object->controls[$key]['addNoParent']) ? $object->controls[$key]['addNoParent'] : true;
$criteria = new icms_db_criteria_Compo();
$criteria->setSort("weight, " . $category_title_field);
$category_handler = icms_getModuleHandler('category', $object->handler->_moduleName);
$categories = $category_handler->getObjects($criteria);
$mytree = new icms_ipf_Tree($categories, "category_id", "category_pid");
parent::__construct($object->vars[$key]['form_caption'], $key, $object->getVar($key, 'e'));
$ret = array();
$options = $this->getOptionArray($mytree, $category_title_field, 0, $ret, "");
if ($addNoParent) {
$newOptions = array('0' => '----');
foreach ($options as $k => $v) {
$newOptions[$k] = $v;
}
$options = $newOptions;
}
$this->addOptionArray($options);
}
示例9: smarty_function_xoInboxCount
function smarty_function_xoInboxCount($params, &$smarty)
{
if (!isset(icms::$user) || !is_object(icms::$user)) {
return;
}
$time = time();
if (isset($_SESSION['xoops_inbox_count']) && @$_SESSION['xoops_inbox_count_expire'] > $time) {
$count = (int) $_SESSION['xoops_inbox_count'];
} else {
$pm_handler = icms::handler('icms_data_privmessage');
$criteria = new icms_db_criteria_Compo(new icms_db_criteria_Item('read_msg', 0));
$criteria->add(new icms_db_criteria_Item('to_userid', icms::$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;
}
}
示例10: profile_search
/**
* Return search results and show images on userinfo page
*
* @param array $queryarray the terms to look
* @param text $andor the conector between the terms to be looked
* @param int $limit The number of maximum results
* @param int $offset from wich register start
* @param int $userid from which user to look
* @return array $ret with all results
*/
function profile_search($queryarray, $andor, $limit, $offset, $userid)
{
global $icmsConfigUser;
$ret = array();
$i = 0;
$dirname = basename(dirname(dirname(__FILE__)));
// check if anonymous users can access profiles
if (!is_object(icms::$user) && !$icmsConfigUser['allow_annon_view_prof']) {
return $ret;
}
// check if tribes are activated in module configuration
$module = icms::handler('icms_module')->getByDirname($dirname, TRUE);
if (!$module->config['enable_tribes']) {
return $ret;
}
$profile_tribes_handler = icms_getModuleHandler('tribes', basename(dirname(dirname(__FILE__))), 'profile');
$criteria = new icms_db_criteria_Compo();
// if those two lines are uncommented, "all search results" isn't showing in the search results
//if ($offset) $criteria->setStart($offset);
//if ($limit) $criteria->setLimit((int)$limit);
$criteria->setSort('title');
if ($userid) {
$criteria->add(new icms_db_criteria_Item('uid_owner', $userid));
}
if (is_array($queryarray) && count($queryarray) > 0) {
foreach ($queryarray as $query) {
$criteria_query = new icms_db_criteria_Compo();
$criteria_query->add(new icms_db_criteria_Item('title', '%' . $query . '%', 'LIKE'));
$criteria_query->add(new icms_db_criteria_Item('tribe_desc', '%' . $query . '%', 'LIKE'), 'OR');
$criteria->add($criteria_query, $andor);
unset($criteria_query);
}
}
$tribes = $profile_tribes_handler->getObjects($criteria, false, false);
foreach ($tribes as $tribe) {
$ret[$i++] = array("image" => 'images/tribes.gif', "link" => $tribe['itemUrl'], "title" => $tribe['title'], "time" => strtotime($tribe['creation_time']), "uid" => $tribe['uid_owner']);
}
return $ret;
}
示例11: getPostCriteria
/**
* Create the criteria that will be used by getPosts
*
* @param int $start to which record to start
* @param int $limit limit of posts to return
* @param int $post_id id of the post
* @param int $topic_id id of the topic the post belongs to
* @param int $tribes_id id of the tribe the topic / post belongs to
* @param string $order sort order for the result list
* @return icms_db_criteria_Compo $criteria
*/
private function getPostCriteria($start = 0, $limit = 0, $post_id = false, $topic_id = false, $tribes_id = false, $order = 'ASC')
{
$criteria = new icms_db_criteria_Compo();
if ($start) {
$criteria->setStart((int) $start);
}
if ($limit) {
$criteria->setLimit((int) $limit);
}
$criteria->setSort('post_id');
$criteria->setOrder($order);
if ($post_id) {
$criteria->add(new icms_db_criteria_Item('post_id', (int) $post_id));
}
if ($topic_id) {
$criteria->add(new icms_db_criteria_Item('topic_id', (int) $topic_id));
}
if ($tribes_id) {
$criteria->add(new icms_db_criteria_Item('tribes_id', (int) $tribes_id));
}
return $criteria;
}
示例12: getVisitorsCriteria
/**
* Create the criteria that will be used by getVisitors
*
* @param int $start to which record to start
* @param int $limit limit of tribes to return
* @param int $uid_owner if specifid, only the tribes of this user will be returned
* @param int $uid_visitor if specified, only the records with the specified user as a visitor will be returned
* @param int $visit_time if specified, only records with a visit time greater than the specified on will be returned
* @return icms_db_criteria_Compo $criteria
*/
private function getVisitorsCriteria($start = 0, $limit = 0, $uid_owner = false, $uid_visitor = false, $visit_time = false)
{
$criteria = new icms_db_criteria_Compo();
if ($start) {
$criteria->setStart((int) $start);
}
if ($limit) {
$criteria->setLimit((int) $limit);
}
$criteria->setSort('visit_time');
$criteria->setOrder('DESC');
if ($uid_owner) {
$criteria->add(new icms_db_criteria_Item('uid_owner', (int) $uid_owner));
}
if ($uid_visitor) {
$criteria->add(new icms_db_criteria_Item('uid_visitor', (int) $uid_visitor));
}
if ($visit_time) {
$criteria->add(new icms_db_criteria_Item('visit_time', $visit_time, '>='));
}
return $criteria;
}
示例13: getTopicCriteria
/**
* Create the criteria that will be used by getTopics
*
* @param int $start to which record to start
* @param int $limit limit of topics to return
* @param int $topic_id id of the topic
* @param int $tribes_id id of the tribe the topic belongs to
* @return icms_db_criteria_Compo $criteria
*/
private function getTopicCriteria($start = 0, $limit = 0, $topic_id = false, $tribes_id = false)
{
$criteria = new icms_db_criteria_Compo();
if ($start) {
$criteria->setStart((int) $start);
}
if ($limit) {
$criteria->setLimit((int) $limit);
}
$criteria->setSort('last_post_time');
$criteria->setOrder('DESC');
if ($topic_id) {
$criteria->add(new icms_db_criteria_Item('topic_id', (int) $topic_id));
}
if ($tribes_id) {
$criteria->add(new icms_db_criteria_Item('tribes_id', (int) $tribes_id));
}
return $criteria;
}
示例14: getAudioCriteria
/**
* Create the criteria that will be used by getAudios and getAudioCount
*
* @param int $start to which record to start
* @param int $limit limit of audio to return
* @param int $uid_owner if specifid, only the audio of this user will be returned
* @param int $audio_id ID of a single audio to retrieve
* @return icms_db_criteria_Compo $criteria
*/
private function getAudioCriteria($start = 0, $limit = 0, $uid_owner = false, $audio_id = false)
{
$criteria = new icms_db_criteria_Compo();
if ($start) {
$criteria->setStart((int) $start);
}
if ($limit) {
$criteria->setLimit((int) $limit);
}
if ($uid_owner) {
$criteria->add(new icms_db_criteria_Item('uid_owner', (int) $uid_owner));
}
if ($audio_id) {
$criteria->add(new icms_db_criteria_Item('audio_id', (int) $audio_id));
}
$criteria->setSort('creation_time');
$criteria->setOrder('DESC');
return $criteria;
}
示例15: getConfigsCriteria
/**
* Create the criteria that will be used by getConfigs and getConfigsCount
*
* @param int $start to which record to start
* @param int $limit limit of configs to return
* @param int $uid_owner if specifid, only the configs of this user will be returned
* @param int $configs_id ID of a single config to retrieve
* @return icms_db_criteria_Compo $criteria
*/
private function getConfigsCriteria($start = 0, $limit = 0, $uid_owner = false, $configs_id = false)
{
$criteria = new icms_db_criteria_Compo();
if ($start) {
$criteria->setStart((int) $start);
}
if ($limit) {
$criteria->setLimit((int) $limit);
}
if ($uid_owner) {
$criteria->add(new icms_db_criteria_Item('config_uid', (int) $uid_owner));
}
if ($configs_id) {
$criteria->add(new icms_db_criteria_Item('configs_id', (int) $configs_id));
}
return $criteria;
}