本文整理汇总了PHP中icms_db_criteria_Compo::add方法的典型用法代码示例。如果您正苦于以下问题:PHP icms_db_criteria_Compo::add方法的具体用法?PHP icms_db_criteria_Compo::add怎么用?PHP icms_db_criteria_Compo::add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类icms_db_criteria_Compo
的用法示例。
在下文中一共展示了icms_db_criteria_Compo::add方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getFriendshipsCriteria
/**
* Create the criteria that will be used by getFriendships
*
* @param int $start to which record to start
* @param int $limit max friendships to display
* @param int $friend1_uid only the friendship of this user will be returned
* @param int $friend2_uid if specifid, the friendship of these two users will be returned.
* @param int $status only get friendships with the specified status
* @return icms_db_criteria_Compo $criteria
*/
private function getFriendshipsCriteria($start = 0, $limit = 0, $friend1_uid = 0, $friend2_uid = 0, $status = 0)
{
$criteria = new icms_db_criteria_Compo();
if ($start) {
$criteria->setStart((int) $start);
}
if ($limit) {
$criteria->setLimit((int) $limit);
}
$criteria->setSort('creation_time');
$criteria->setOrder('DESC');
if ($status == PROFILE_FRIENDSHIP_STATUS_PENDING && $friend2_uid) {
$criteria->add(new icms_db_criteria_Item('status', (int) $status));
$criteria->add(new icms_db_criteria_Item('friend2_uid', (int) $friend2_uid));
} else {
if ($status) {
$criteria->add(new icms_db_criteria_Item('status', (int) $status));
}
if ($friend2_uid > 0) {
$criteria->add(new icms_db_criteria_Item('friend1_uid', (int) $friend1_uid));
$criteria->add(new icms_db_criteria_Item('friend2_uid', (int) $friend2_uid));
$criteria->add(new icms_db_criteria_Item('friend1_uid', (int) $friend2_uid), 'OR');
$criteria->add(new icms_db_criteria_Item('friend2_uid', (int) $friend1_uid));
} elseif ($friend1_uid > 0) {
$criteria->add(new icms_db_criteria_Item('friend1_uid', (int) $friend1_uid));
$criteria->add(new icms_db_criteria_Item('friend2_uid', (int) $friend1_uid), 'OR');
}
if ($status) {
$criteria->add(new icms_db_criteria_Item('status', (int) $status));
}
}
return $criteria;
}
示例2: 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();
}
}
示例3: 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;
}
示例4: 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;
}
示例5: 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);
}
示例6: 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);
}
}
示例7: 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;
}
示例8: 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;
}
示例9: 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;
}
示例10: __construct
/**
* Constructor
*
* @param string $caption
* @param string $name
* @param mixed $value Pre-selected value (or array of them).
* For an item with massive members, such as "Registered Users", "$value" should be used to store selected temporary users only instead of all members of that item
* @param bool $include_anon Include user "anonymous"?
* @param int $size Number or rows. "1" makes a drop-down-list.
* @param bool $multiple Allow multiple selections?
*/
public function __construct($caption, $name, $include_anon = FALSE, $value = NULL, $size = 1, $multiple = FALSE, $showremovedusers = FALSE, $justremovedusers = FALSE)
{
$limit = 200;
$select_element = new icms_form_elements_Select('', $name, $value, $size, $multiple);
if ($include_anon) {
$select_element->addOption(0, $GLOBALS['icmsConfig']['anonymous']);
}
$member_handler = icms::handler('icms_member');
$user_count = $member_handler->getUserCount();
$value = is_array($value) ? $value : (empty($value) ? array() : array($value));
if ($user_count > $limit && count($value) > 0) {
$criteria = new icms_db_criteria_Compo(new icms_db_criteria_Item("uid", "(" . implode(",", $value) . ")", "IN"));
} else {
$criteria = new icms_db_criteria_Compo();
$criteria->setLimit($limit);
}
$criteria->setSort('uname');
if (!$showremovedusers) {
$criteria->add(new icms_db_criteria_Item('level', '-1', '!='));
} elseif ($showremovedusers && $justremovedusers) {
$criteria->add(new icms_db_criteria_Item('level', '-1'));
}
$criteria->setOrder('ASC');
$users = $member_handler->getUserList($criteria);
$select_element->addOptionArray($users);
if ($user_count <= $limit) {
parent::__construct($caption, "", $name);
$this->addElement($select_element);
return;
}
icms_loadLanguageFile('core', 'findusers');
$js_addusers = "<script type=\"text/javascript\">\r\n\t\t\t\t\tfunction addusers(opts){\r\n\t\t\t\t\t\tvar num = opts.substring(0, opts.indexOf(\":\"));\r\n\t\t\t\t\t\topts = opts.substring(opts.indexOf(\":\")+1, opts.length);\r\n\t\t\t\t\t\tvar sel = xoopsGetElementById(\"" . $name . ($multiple ? "[]" : "") . "\");\r\n\t\t\t\t\t\tvar arr = new Array(num);\r\n\t\t\t\t\t\tfor (var n=0; n < num; n++) {\r\n\t\t\t\t\t\t\tvar nm = opts.substring(0, opts.indexOf(\":\"));\r\n\t\t\t\t\t\t\topts = opts.substring(opts.indexOf(\":\")+1, opts.length);\r\n\t\t\t\t\t\t\tvar val = opts.substring(0, opts.indexOf(\":\"));\r\n\t\t\t\t\t\t\topts = opts.substring(opts.indexOf(\":\")+1, opts.length);\r\n\t\t\t\t\t\t\tvar txt = opts.substring(0, nm - val.length);\r\n\t\t\t\t\t\t\topts = opts.substring(nm - val.length, opts.length);\r\n\t\t\t\t\t\t\tvar added = false;\r\n\t\t\t\t\t\t\tfor (var k = 0; k < sel.options.length; k++) {\r\n\t\t\t\t\t\t\t\tif (sel.options[k].value == val){\r\n\t\t\t\t\t\t\t\t\tadded = true;\r\n\t\t\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\tif (added == false) {\r\n\t\t\t\t\t\t\t\tsel.options[k] = new Option(txt, val);\r\n\t\t\t\t\t\t\t\tsel.options[k].selected = true;\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\treturn true;\r\n\t\t\t\t\t}\r\n\t\t\t\t\t</script>";
$token = icms::$security->createToken();
$action_tray = new icms_form_elements_Tray("", " | ");
$action_tray->addElement(new icms_form_elements_Label('', "<a href='#' onclick='var sel = xoopsGetElementById(\"" . $name . ($multiple ? "[]" : "") . "\");for (var i = sel.options.length-1; i >= 0; i--) {if (!sel.options[i].selected) {sel.options[i] = null;}}; return false;'>" . _MA_USER_REMOVE . "</a>"));
$action_tray->addElement(new icms_form_elements_Label('', "<a href='#' onclick='openWithSelfMain(\"" . ICMS_URL . "/include/findusers.php?target={$name}&multiple={$multiple}&token={$token}\", \"userselect\", 800, 600, null); return false;' >" . _MA_USER_MORE . "</a>" . $js_addusers));
parent::__construct($caption, '<br /><br />', $name);
$this->addElement($select_element);
$this->addElement($action_tray);
}
示例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: 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;
}
示例14: 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;
}
示例15: 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;
}
}