本文整理汇总了PHP中icms_db_criteria_Compo类的典型用法代码示例。如果您正苦于以下问题:PHP icms_db_criteria_Compo类的具体用法?PHP icms_db_criteria_Compo怎么用?PHP icms_db_criteria_Compo使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了icms_db_criteria_Compo类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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;
}
开发者ID:LeeGlendenning,项目名称:formulize,代码行数:38,代码来源:PicturesHandler.php
示例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;
}
开发者ID:LeeGlendenning,项目名称:formulize,代码行数:35,代码来源:Handler.php
示例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();
}
}
开发者ID:LeeGlendenning,项目名称:formulize,代码行数:35,代码来源:Handler.php
示例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);
}
}
开发者ID:nao-pon,项目名称:impresscms,代码行数:34,代码来源:userinfo.php
示例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;
}
开发者ID:LeeGlendenning,项目名称:formulize,代码行数:52,代码来源:blocks.php
示例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);
}
开发者ID:LeeGlendenning,项目名称:formulize,代码行数:21,代码来源:VisibilityHandler.php
示例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;
}
开发者ID:LeeGlendenning,项目名称:formulize,代码行数:26,代码来源:Handler.php
示例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);
}
开发者ID:nao-pon,项目名称:impresscms,代码行数:26,代码来源:Parentcategory.php
示例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;
}
}
开发者ID:LeeGlendenning,项目名称:formulize,代码行数:22,代码来源:function.xoInboxCount.php
示例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;
}
开发者ID:LeeGlendenning,项目名称:formulize,代码行数:49,代码来源:search.inc.php
示例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;
}
开发者ID:LeeGlendenning,项目名称:formulize,代码行数:33,代码来源:TribepostHandler.php
示例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;
}
开发者ID:LeeGlendenning,项目名称:formulize,代码行数:32,代码来源:VisitorsHandler.php
示例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;
}
开发者ID:LeeGlendenning,项目名称:formulize,代码行数:28,代码来源:TribetopicHandler.php
示例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;
}
开发者ID:LeeGlendenning,项目名称:formulize,代码行数:28,代码来源:AudioHandler.php
示例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;
}
开发者ID:LeeGlendenning,项目名称:formulize,代码行数:26,代码来源:ConfigsHandler.php
示例16: __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);
}
开发者ID:nao-pon,项目名称:impresscms,代码行数:51,代码来源:User.php
示例17: templateExists
/**
* Does the template exist in the database in the template set
*
* @param string $tplname template name
* @param string $tplset_name template set name
* @return bool true if exists, false if not
**/
public function templateExists($tplname, $tplset_name)
{
$criteria = new icms_db_criteria_Compo(new icms_db_criteria_Item('tpl_file', trim($tplname)));
$criteria->add(new icms_db_criteria_Item('tpl_tplset', trim($tplset_name)));
if ($this->getCount($criteria) > 0) {
return true;
}
return false;
}
开发者ID:LeeGlendenning,项目名称:formulize,代码行数:16,代码来源:Handler.php
示例18: getPage
/**
* generate the modid (combination of current module and page) and store it in a static var
* isStart is only needed for this class (used in function retrieveBlocks()).
*
* @global array $icmsConfig ImpressCMS configuration array
* @global icms_module_Object $icmsModule current module
* @return void
*/
public static function getPage()
{
global $icmsConfig, $icmsModule;
if (is_array(self::$modid)) {
return self::$modid;
}
// getting the start module and page configured in the admin panel
if (is_array($icmsConfig['startpage'])) {
$member_handler = icms::handler('icms_member');
$group = $member_handler->getUserBestGroup(is_object(icms::$user) ? icms::$user->getVar('uid') : 0);
$icmsConfig['startpage'] = $icmsConfig['startpage'][$group];
}
$startMod = $icmsConfig['startpage'] == '--' ? 'system' : $icmsConfig['startpage'];
// setting the full and relative url of the actual page
$clean_request = filter_var($_SERVER['REQUEST_URI'], FILTER_SANITIZE_URL);
$fullurl = icms::$urls['http'] . icms::$urls['httphost'] . $clean_request;
$url = substr(str_replace(ICMS_URL, '', $fullurl), 1);
$icms_page_handler = icms::handler('icms_data_page');
$criteria = new icms_db_criteria_Compo(new icms_db_criteria_Item('page_url', $fullurl));
if (!empty($url)) {
$criteria->add(new icms_db_criteria_Item('page_url', $url), 'OR');
}
$pages = $icms_page_handler->getCount($criteria);
if ($pages > 0) {
// we have a sym-link defined for this page
$pages = $icms_page_handler->getObjects($criteria);
$page = $pages[0];
$purl = filter_var($page->getVar('page_url'), FILTER_SANITIZE_URL);
$mid = (int) $page->getVar('page_moduleid');
$pid = $page->getVar('page_id');
$module_handler = icms::handler('icms_module');
$module = $module_handler->get($mid);
$dirname = $module->getVar('dirname');
$isStart = $startMod == $mid . '-' . $pid;
} else {
// we don't have a sym-link for this page
if (is_object($icmsModule)) {
$mid = (int) $icmsModule->getVar('mid');
$dirname = $icmsModule->getVar('dirname');
$isStart = substr($_SERVER['PHP_SELF'], -9) == 'index.php' && $startMod == $dirname;
} else {
$mid = 1;
$dirname = 'system';
$isStart = !empty($GLOBALS['xoopsOption']['show_cblock']);
}
$pid = 0;
}
/* determine the visitor's start page and update the request based on that? */
if ($isStart) {
self::$modid = array('module' => 0, 'page' => 1, 'isStart' => $isStart);
} else {
$criteria = new icms_db_criteria_Compo(new icms_db_criteria_Item('page_status', 1));
$pages = $icms_page_handler->getObjects($criteria);
$pid = 0;
foreach ($pages as $page) {
$purl = filter_var($page->getVar('page_url'), FILTER_SANITIZE_URL);
if (substr($purl, -1) == '*') {
$purl = substr($purl, 0, -1);
if (substr($url, 0, strlen($purl)) == $purl || substr($fullurl, 0, strlen($purl)) == $purl) {
$pid = $page->getVar('page_id');
break;
}
} else {
if ($purl == $url || $purl == $fullurl) {
$pid = $page->getVar('page_id');
break;
}
}
}
self::$modid = array('module' => $mid, 'page' => $pid, 'isStart' => $isStart);
}
return self::$modid;
}
开发者ID:LeeGlendenning,项目名称:formulize,代码行数:81,代码来源:PageBuilder.php
示例19: getPageSelOptions
/**
* build options string
*
* @param mixed $value module-page combination
* @return string html
*/
private function getPageSelOptions($value = NULL)
{
$icms_page_handler = icms::handler('icms_data_page');
if (!is_array($value)) {
$value = array($value);
}
$module_handler = icms::handler('icms_module');
$criteria = new icms_db_criteria_Compo(new icms_db_criteria_Item('hasmain', 1));
$criteria->add(new icms_db_criteria_Item('isactive', 1));
$module_list = $module_handler->getObjects($criteria);
$mods = '';
foreach ($module_list as $module) {
$mods .= '<optgroup label="' . $module->getVar('name') . '">';
$criteria = new icms_db_criteria_Compo(new icms_db_criteria_Item('page_moduleid', $module->getVar('mid')));
$criteria->add(new icms_db_criteria_Item('page_status', 1));
$pages = $icms_page_handler->getObjects($criteria);
$sel = '';
if (in_array($module->getVar('mid') . '-0', $value)) {
$sel = ' selected=selected';
}
$mods .= '<option value="' . $module->getVar('mid') . '-0"' . $sel . '>' . _AM_ALLPAGES . '</option>';
foreach ($pages as $page) {
$sel = '';
if (in_array($module->getVar('mid') . '-' . $page->getVar('page_id'), $value)) {
$sel = ' selected=selected';
}
$mods .= '<option value="' . $module->getVar('mid') . '-' . $page->getVar('page_id') . '"' . $sel . '>';
$mods .= $page->getVar('page_title') . '</option>';
}
$mods .= '</optgroup>';
}
$module = $module_handler->get(1);
$criteria = new icms_db_criteria_Compo(new icms_db_criteria_Item('page_moduleid', 1));
$criteria->add(new icms_db_criteria_Item('page_status', 1));
$pages = $icms_page_handler->getObjects($criteria);
$cont = '';
if (count($pages) > 0) {
$cont = '<optgroup label="' . $module->getVar('name') . '">';
$sel = '';
if (in_array($module->getVar('mid') . '-0', $value)) {
$sel = ' selected=selected';
}
$cont .= '<option value="' . $module->getVar('mid') . '-0"' . $sel . '>' . _AM_ALLPAGES . '</option>';
foreach ($pages as $page) {
$sel = '';
if (in_array($module->getVar('mid') . '-' . $page->getVar('page_id'), $value)) {
$sel = ' selected=selected';
}
$cont .= '<option value="' . $module->getVar('mid') . '-' . $page->getVar('page_id') . '"' . $sel . '>';
$cont .= $page->getVar('page_title') . '</option>';
}
$cont .= '</optgroup>';
}
$sel = $sel1 = '';
if (in_array('0-1', $value)) {
$sel = ' selected=selected';
}
if (in_array('0-0', $value)) {
$sel1 = ' selected=selected';
}
$ret = '<option value="0-1"' . $sel . '>' . _AM_TOPPAGE . '</option>';
$ret .= '<option value="0-0"' . $sel1 . '>' . _AM_ALLPAGES . '</option>';
$ret .= $cont . $mods;
return $ret;
}
开发者ID:nao-pon,项目名称:impresscms,代码行数:71,代码来源:Page.php
示例20: render
/**
*
* @param $fetchOnly
* @param $debug
*/
public function render($fetchOnly = false, $debug = false)
{
global $impresscms;
$this->_tpl = new icms_view_Tpl();
/**
* We need access to the vars of the icms_ipf_Object for a few things in the table creation.
* Since we may not have an icms_ipf_Object to look into now, let's create one for this purpose
* and we will free it after
*/
$this->_tempObject =& $this->_objectHandler->create();
$this->_criteria->setStart(isset($_GET['start' . $this->_objectHandler->keyName]) ? (int) $_GET['start' . $this->_objectHandler->keyName] : 0);
$this->setSortOrder();
if (!$this->_isTree) {
$this->_limitsel = isset($_GET['limitsel']) ? $_GET['limitsel'] : icms_getCookieVar($_SERVER['SCRIPT_NAME'] . '_limitsel', '15');
} else {
$this->_limitsel = 'all';
}
$this->_limitsel = isset($_POST['limitsel']) ? $_POST['limitsel'] : $this->_limitsel;
icms_setCookieVar($_SERVER['SCRIPT_NAME'] . '_limitsel', $this->_limitsel);
$limitsArray = $this->getLimitsArray();
$this->_criteria->setLimit($this->_limitsel);
$this->_filtersel = isset($_GET['filtersel']) ? $_GET['filtersel'] : $this->getDefaultFilter();
$this->_filtersel = isset($_POST['filtersel']) ? $_POST['filtersel'] : $this->_filtersel;
icms_setCookieVar($_SERVER['SCRIPT_NAME'] . '_' . $this->_id . '_filtersel', $this->_filtersel);
$filtersArray = $this->getFiltersArray();
if ($filtersArray) {
$this->_tpl->assign('icms_optionssel_filtersArray', $filtersArray);
}
// Check if the selected filter is defined and if so, create the selfilter2
if (isset($this->_filterseloptions[$this->_filtersel])) {
// check if method associate with this filter exists in the handler
if (is_array($this->_filterseloptions[$this->_filtersel])) {
$filter = $this->_filterseloptions[$this->_filtersel];
$this->_criteria->add($filter['criteria']);
} else {
if (method_exists($this->_objectHandler, $this->_filterseloptions[$this->_filtersel])) {
// then we will create the selfilter2 options by calling this method
$method = $this->_filterseloptions[$this->_filtersel];
$this->_filtersel2options = $this->_objectHandler->{$method}();
$this->_filtersel2 = isset($_GET['filtersel2']) ? $_GET['filtersel2'] : $this->getDefaultFilter2();
$this->_filtersel2 = isset($_POST['filtersel2']) ? $_POST['filtersel2'] : $this->_filtersel2;
$filters2Array = $this->getFilters2Array();
$this->_tpl->assign('icms_optionssel_filters2Array', $filters2Array);
icms_setCookieVar($_SERVER['SCRIPT_NAME'] . '_filtersel2', $this->_filtersel2);
if ($this->_filtersel2 != 'default') {
$this->_criteria->add(new icms_db_criteria_Item($this->_filtersel, $this->_filtersel2));
}
}
}
}
// Check if we have a quicksearch
if (isset($_POST['quicksearch_' . $this->_id]) && $_POST['quicksearch_' . $this->_id] != '') {
$quicksearch_criteria = new icms_db_criteria_Compo();
if (is_array($this->_quickSearch['fields'])) {
foreach ($this->_quickSearch['fields'] as $v) {
$quicksearch_criteria->add(new icms_db_criteria_Item($v, '%' . $_POST['quicksearch_' . $this->_id] . '%', 'LIKE'), 'OR');
}
} else {
$quicksearch_criteria->add(new icms_db_criteria_Item($this->_quickSearch['fields'], '%' . $_POST['quicksearch_' . $this->_id] . '%', 'LIKE'));
}
$this->_criteria->add($quicksearch_criteria);
}
$this->_objects = $this->fetchObjects($debug);
/**
* $params_of_the_options_sel is an array with all the parameters of the page
* but without the pagenave parameters. This array will be used in the
* OptionsSelection
*/
$params_of_the_options_sel = array();
if ($this->_criteria->getLimit() > 0) {
/**
* Geeting rid of the old params
* $new_get_array is an array containing the new GET parameters
*/
$new_get_array = array();
$not_need
|
请发表评论