/** * get keywords * * @access public * @param int $item_id * @return array object array */ function &getKeywords($item_id) { $criteria = new Criteria('item_id', $item_id); $criteria->setSort('keyword_id'); $criteria->setOrder('ASC'); return $this->getObjects($criteria); }
function b_mysearch_last_search_show() { include_once XOOPS_ROOT_PATH . '/modules/mysearch/include/functions.php'; $mysearch_handler =& xoops_getmodulehandler('searches', 'mysearch'); $visiblekeywords = 0; $block = array(); $visiblekeywords = mysearch_getmoduleoption('showindex'); if ($visiblekeywords > 0) { $block['visiblekeywords'] = $visiblekeywords; $totalcount = $mysearch_handler->getCount(); $start = 0; $critere = new Criteria('mysearchid', 0, '<>'); $critere->setSort('datesearch'); $critere->setLimit($visiblekeywords); $critere->setStart($start); $critere->setOrder('DESC'); $tmpmysearch = new searches(); $elements = $mysearch_handler->getObjects($critere); foreach ($elements as $oneelement) { $search = array(); $search['keyword'] = $oneelement->getVar('keyword'); $search['date'] = formatTimestamp(strtotime($oneelement->getVar('datesearch'))); $search['uid'] = $oneelement->getVar('keyword'); $search['uname'] = $tmpmysearch->uname($oneelement->getVar('uid')); $search['link'] = "<a href='" . XOOPS_URL . '/search.php?query=' . $oneelement->getVar('keyword') . "&action=results' target='_blank'>"; $block['searches'][] = $search; unset($search); } } return $block; }
public static function __callStatic($name, $arguments) { $pos = strpos($name, 'getListBy'); if ($pos !== false) { $class = get_called_class(); $table = $class::TABLE; $att = str_replace('getListBy', '', $name); $tabledesc = self::getTableDescription($table); foreach ($tabledesc as $field) { if (strtolower($field) == strtolower($att)) { $c = new Criteria(); $c->setOrder($field); return $class::getList($c); } } } $pos = strpos($name, 'findBy'); if ($pos !== false) { $class = get_called_class(); $table = $class::TABLE; $att = str_replace('findBy', '', $name); $tabledesc = self::getTableDescription($table); foreach ($tabledesc as $field) { if (strtolower($field) == strtolower($att)) { $c = new Criteria(); if (count($arguments)) { $c->addCondition($field, '=', $arguments[0]); } return $class::getList($c); } } } }
function execute(&$controller, &$request, &$user) { exFrame::init(EXFRAME_PERM); // 閲覧権限のチェック exPerm::GuardRedirect('view_detail', 'index.php', _MD_PLZXOO_ERROR_PERMISSION); $id = isset($_REQUEST['qid']) ? intval($_REQUEST['qid']) : 0; $handler =& plzXoo::getHandler('question'); $question =& $handler->get($id); if (!is_object($question)) { return VIEW_ERROR; } // ステータスが1,2と異なるものは管理者以外キック if (!in_array($question->getVar('status'), array(1, 2))) { if (!is_object($GLOBALS['xoopsUser']) || !$GLOBALS['xoopsUser']->isAdmin()) { return VIEW_ERROR; } } $handler =& plzXoo::getHandler('answer'); $criteria = new Criteria('qid', $id); $criteria->setSort('input_date'); $criteria->setOrder('DESC'); $answers =& $handler->getObjects($criteria); $request->setAttribute('question', $question); $request->setAttribute('answers', $answers); return VIEW_SUCCESS; }
/** * get titles * * @access public * @param int $item_id * @return array object array */ function &getTitles($item_id) { $criteria = new Criteria('item_id', $item_id); $criteria->setSort('title_id'); $criteria->setOrder('ASC'); return $this->getObjects($criteria); }
/** * get change logs * * @access public * @param int $item_id * @return array objects */ function getChangeLogs($item_id) { $criteria = new Criteria('item_id', $item_id); $criteria->setSort('log_date'); $criteria->setOrder('DESC'); return $this->getObjects($criteria); }
function b_mypics_lastpictures_show($options) { $criteria = new Criteria('id', 0, '>'); $criteria->setSort('id'); $criteria->setOrder('DESC'); $criteria->setLimit($options[0]); $handler = xoops_getModuleHandler('image', 'mypics'); $block = $handler->getLastPicturesForBlock($options[0]); return $block; }
/** * Return All TAX * * @param integer $start Position de départ * @param integer $limit Nombre total d'enregistrements à renvoyer * @param string $order Champ sur lequel faire le tri * @param string $order Ordre du tri * @param boolean $idaskey Indique si le tableau renvoyé doit avoir pour clé l'identifiant unique de l'enregistrement * @return array tableau d'objets de type TVA */ function getAllVats($start = 0, $limit = 0, $sort = 'vat_id', $order = 'ASC', $idaskey = true) { $critere = new Criteria('vat_id', 0, '<>'); $critere->setLimit($limit); $critere->setStart($start); $critere->setSort($sort); $critere->setOrder($order); $tblVats = array(); $tblVats = $this->getObjects($critere, $idaskey); return $tblVats; }
/** * Renvoie la liste de tous les vendeurs du module * * @param integer $start Position de départ * @param integer $limit Nombre total d'enregistrements à renvoyer * @param string $order Champ sur lequel faire le tri * @param string $order Ordre du tri * @param boolean $idaskey Indique si le tableau renvoyé doit avoir pour clé l'identifiant unique de l'enregistrement * @return array tableau d'objets de type stores */ function getAllStores($start = 0, $limit = 0, $sort = 'store_name', $order = 'ASC', $idaskey = true) { $critere = new Criteria('store_id', 0, '<>'); $critere->setLimit($limit); $critere->setStart($start); $critere->setSort($sort); $critere->setOrder($order); $tbl_categs = array(); $tbl_categs = $this->getObjects($critere, $idaskey); return $tbl_categs; }
/** * Returns the (x) last votes * * @param integer $start Starting position * @param integer $limit count of items to return * @return array Array of votedata objects */ function getLastVotes($start = 0, $limit = 0) { $tbl_datas = array(); $criteria = new Criteria('vote_ratingid', 0, '<>'); $criteria->setLimit($limit); $criteria->setStart($start); $criteria->setSort('vote_ratingtimestamp'); $criteria->setOrder('DESC'); $tbl_datas = $this->getObjects($criteria, true); return $tbl_datas; }
public function getAllLocation(oledrion_parameters $parameters) { $parameters = $parameters->extend(new oledrion_parameters(array('start' => 0, 'limit' => 0, 'sort' => 'location_id', 'order' => 'ASC'))); $critere = new Criteria('location_id', 0, '<>'); $critere->setLimit($parameters['limit']); $critere->setStart($parameters['start']); $critere->setSort($parameters['sort']); $critere->setOrder($parameters['order']); $location = array(); $location = $this->getObjects($critere); return $location; }
/** * Renvoie la liste de toutes les TVA du module * * @param integer $start Position de départ * @param integer $limit Nombre total d'enregistrements à renvoyer * @param string $order Champ sur lequel faire le tri * @param string $order Ordre du tri * @param boolean $idaskey Indique si le tableau renvoyé doit avoir pour clé l'identifiant unique de l'enregistrement * @return array tableau d'objets de type TVA */ public function getAllVats(oledrion_parameters $parameters) { $parameters = $parameters->extend(new oledrion_parameters(array('start' => 0, 'limit' => 0, 'sort' => 'vat_id', 'order' => 'ASC', 'idaskey' => true))); $critere = new Criteria('vat_id', 0, '<>'); $critere->setLimit($parameters['limit']); $critere->setStart($parameters['start']); $critere->setSort($parameters['sort']); $critere->setOrder($parameters['order']); $vats = array(); $vats = $this->getObjects($critere, $parameters['idaskey']); return $vats; }
function b_xoonips_userlist_show() { global $xoopsDB; $uid = is_object($xoopsUser) ? $xoopsUser->getVar('uid', 'n') : UID_GUEST; // hide block if user is invalid xoonips user $xsession_handler =& xoonips_getormhandler('xoonips', 'session'); if (!$xsession_handler->validateUser($uid, false)) { return false; } $tables['users'] = $xoopsDB->prefix('users'); $tables['xusers'] = $xoopsDB->prefix('xoonips_users'); $user_handler =& xoonips_getormhandler('xoonips', 'xoops_users'); $positions_handler =& xoonips_getormhandler('xoonips', 'positions'); // get visible positions $criteria = new Criteria('posi_order', 0, '>'); $criteria->setSort('posi_order'); $criteria->setOrder('ASC'); $position_objs =& $positions_handler->getObjects($criteria); $positions = array(); foreach ($position_objs as $position_obj) { $posi_id = $position_obj->getVar('posi_id', 'n'); $posi_title = $position_obj->getVar('posi_title', 's'); // get visible users, who set position to $posi_id $join_criteria = new XooNIpsJoinCriteria('xoonips_users', 'uid', 'uid'); $criteria = new CriteriaCompo(); $criteria->add(new Criteria($tables['users'] . '.level', '0', '>')); $criteria->add(new Criteria($tables['xusers'] . '.activate', '1')); $criteria->add(new Criteria($tables['xusers'] . '.posi', $posi_id)); $sort = array($tables['users'] . '.uid', $tables['xusers'] . '.user_order'); $criteria->setSort($sort); $criteria->setOrder('ASC'); $fields = array($tables['users'] . '.uid', $tables['users'] . '.uname', $tables['users'] . '.name'); $user_objs =& $user_handler->getObjects($criteria, false, implode(',', $fields), false, $join_criteria); if (!empty($user_objs)) { $position['title'] = $posi_title; $position['users'] = array(); foreach ($user_objs as $user_obj) { $position['users'][] = array('uid' => $user_obj->getVar('uid', 'e'), 'name' => $user_obj->getVar('name', 's'), 'uname' => $user_obj->getVar('uname', 's')); } $positions[] = $position; } } if (empty($positions)) { return false; // visible users not found } // assign block template variables $block = array(); $block['positions'] = $positions; return $block; }
function adminPrepare($element) { $ele_value = $element ? $element->getVar('ele_value') : array(); $fid = $element ? $element->getVar('id_form') : intval($_GET['fid']); if (!$element) { $ele_value[3] = "horizontal"; $ele_value[5] = 1; $ele_value[0] = "caption"; } $background = $ele_value[3]; $sideortop = $ele_value[5] == 1 ? "side" : "above"; $heading = $ele_value[0]; $grid_elements_criteria = new Criteria(); $grid_elements_criteria->setSort('ele_order'); $grid_elements_criteria->setOrder('ASC'); $element_handler = xoops_getmodulehandler('elements', 'formulize'); $grid_elements = $element_handler->getObjects($grid_elements_criteria, $fid); foreach ($grid_elements as $this_element) { $grid_start_options[$this_element->getVar('ele_id')] = $this_element->getVar('ele_colhead') ? printSmart(trans($this_element->getVar('ele_colhead'))) : printSmart(trans($this_element->getVar('ele_caption'))); } return array('grid_start_options' => $grid_start_options, 'background' => $background, 'sideortop' => $sideortop, 'heading' => $heading, 'ele_value' => $ele_value); }
function b_sitemap_newbb() { global $sitemap_configs; $sitemap = array(); $forum_handler =& xoops_getmodulehandler('forum', 'newbb'); /* Allowed forums */ $forums_allowed = $forum_handler->getIdsByPermission(); /* fetch top forums */ $forums_top_id = array(); if (!empty($forums_allowed)) { $crit_top = new CriteriaCompo(new Criteria("parent_forum", 0)); //$crit_top->add(new Criteria("cat_id", "(".implode(", ", array_keys($categories)).")", "IN")); $crit_top->add(new Criteria("forum_id", "(" . implode(", ", $forums_allowed) . ")", "IN")); $forums_top_id = $forum_handler->getIds($crit_top); } $forums_sub_id = array(); if ($sitemap_configs["show_subcategoris"] && !empty($forums_top_id)) { $crit_sub = new CriteriaCompo(new Criteria("parent_forum", "(" . implode(", ", $forums_top_id) . ")", "IN")); $crit_sub->add(new Criteria("forum_id", "(" . implode(", ", $forums_allowed) . ")", "IN")); $forums_sub_id = $forum_handler->getIds($crit_sub); } /* Fetch forum data */ $forums_available = array_merge($forums_top_id, $forums_sub_id); $forums_array = array(); if (!empty($forums_available)) { $crit_forum = new Criteria("forum_id", "(" . implode(", ", $forums_available) . ")", "IN"); $crit_forum->setSort("cat_id ASC, parent_forum ASC, forum_order"); $crit_forum->setOrder("ASC"); $forums_array = $forum_handler->getAll($crit_forum, array("forum_name", "parent_forum", "cat_id"), false); } $forums = array(); foreach ($forums_array as $forumid => $forum) { if (!empty($forum["parent_forum"])) { $forums[$forum['parent_forum']]["fchild"][$forumid] = array('id' => $forumid, 'url' => "viewforum.php?forum=" . $forumid, 'title' => $forum['forum_name']); } else { $forums[$forumid] = array('id' => $forumid, 'cid' => $forum['cat_id'], 'url' => "viewforum.php?forum=" . $forumid, 'title' => $forum['forum_name']); } } if ($sitemap_configs["show_subcategoris"]) { $category_handler =& xoops_getmodulehandler('category', 'newbb'); $categories = $category_handler->getByPermission('access', array("cat_id", "cat_title"), false); foreach ($categories as $key => $category) { $cat_id = $category["cat_id"]; $i = $cat_id; $sitemap['parent'][$i]['id'] = $cat_id; $sitemap['parent'][$i]['title'] = $category["cat_title"]; $sitemap['parent'][$i]['url'] = "index.php?cat=" . $cat_id; } foreach ($forums as $id => $forum) { $cid = $forum['cid']; $sitemap['parent'][$cid]['child'][$id] = $forum; $sitemap['parent'][$cid]['child'][$id]['image'] = 2; if (empty($forum['fchild'])) { continue; } foreach ($forum['fchild'] as $_id => $_forum) { $sitemap['parent'][$cid]['child'][$_id] = $_forum; $sitemap['parent'][$cid]['child'][$_id]['image'] = 3; } } } else { foreach ($forums as $id => $forum) { $sitemap['parent'][$id] = $forum; } } return $sitemap; }
function &loadPreferenceInformations() { $collection = new Legacy_PreferenceInfoCollection(); $handler =& xoops_gethandler('module'); $module =& $handler->getByDirname($this->_mDirname); $handler =& xoops_gethandler('config'); $criteria = new Criteria('conf_modid', $module->get('mid')); $criteria->setOrder('conf_order'); $configArr =& $handler->getConfigs($criteria); foreach (array_keys($configArr) as $idx) { $info =& $this->_createPreferenceInformation($configArr[$idx]); $collection->add($info); } return $collection; }
public static function search() { $publisher =& PublisherPublisher::getInstance(); global $limit, $start, $imagearray, $aSearchBy, $aOrderBy, $aLimitBy, $aSortBy; if (XoopsRequest::getString('deleteMimes', '', 'POST')) { $aMimes = XoopsRequest::getArray('mimes', array(), 'POST'); $crit = new Criteria('mime_id', '(' . implode($aMimes, ',') . ')', 'IN'); if ($publisher->getHandler('mimetype')->deleteAll($crit)) { header('Location: ' . PUBLISHER_ADMIN_URL . "/mimetypes.php?limit={$limit}&start={$start}"); } else { redirect_header(PUBLISHER_ADMIN_URL . "/mimetypes.php?limit={$limit}&start={$start}", 3, _AM_PUBLISHER_MESSAGE_DELETE_MIME_ERROR); } } if (XoopsRequest::getString('add_mime', '', 'POST')) { // header("Location: " . PUBLISHER_ADMIN_URL . "/mimetypes.php?op=add&start=$start&limit=$limit"); redirect_header(PUBLISHER_ADMIN_URL . "/mimetypes.php?op=add&start={$start}&limit={$limit}", 3, _AM_PUBLISHER_MIME_CREATEF); // exit(); } $order = XoopsRequest::getString('order', 'ASC', 'POST'); $sort = XoopsRequest::getString('sort', 'mime_name', 'POST'); publisherCpHeader(); //publisher_adminMenu(4, _AM_PUBLISHER_MIMETYPES . " > " . _AM_PUBLISHER_BUTTON_SEARCH); publisherOpenCollapsableBar('mimemsearchtable', 'mimesearchicon', _AM_PUBLISHER_MIME_SEARCH); if (!XoopsRequest::getString('mime_search', '', 'POST')) { echo "<form action='mimetypes.php?op=search' method='post'>"; echo "<table width='100%' cellspacing='1' class='outer'>"; echo "<tr><th colspan='2'>" . _AM_PUBLISHER_TEXT_SEARCH_MIME . '</th></tr>'; echo "<tr><td class='head' width='20%'>" . _AM_PUBLISHER_TEXT_SEARCH_BY . "</td>\n <td class='even'>\n <select name='search_by'>"; foreach ($aSortBy as $value => $text) { echo "<option value='{$value}'>{$text}</option>"; } unset($value, $text); echo '</select> </td> </tr>'; echo "<tr><td class='head'>" . _AM_PUBLISHER_TEXT_SEARCH_TEXT . "</td>\n <td class='even'>\n <input type='text' name='search_text' id='search_text' value='' />\n </td>\n </tr>"; echo "<tr class='foot'>\n <td colspan='2'>\n <input type='submit' name='mime_search' id='mime_search' value='" . _AM_PUBLISHER_BUTTON_SEARCH . "' />\n </td>\n </tr>"; echo '</table></form>'; } else { $searchField = XoopsRequest::getString('search_by', '', 'POST'); $searchText = XoopsRequest::getString('search_text', '', 'POST'); $crit = new Criteria($searchField, "%{$searchText}%", 'LIKE'); $crit->setSort($sort); $crit->setOrder($order); $crit->setLimit($limit); $crit->setStart($start); $mimeCount =& $publisher->getHandler('mimetype')->getCount($crit); $mimetypes =& $publisher->getHandler('mimetype')->getObjects($crit); $nav = new XoopsPageNav($mimeCount, $limit, $start, 'start', "op=search&limit={$limit}&order={$order}&sort={$sort}&mime_search=1&search_by={$searchField}&search_text={$searchText}"); // Display results echo '<script type="text/javascript" src="' . PUBLISHER_URL . '/include/functions.js"></script>'; echo "<table width='100%' cellspacing='1' class='outer'>"; echo "<tr><td colspan='6' align='right'>"; echo "<form action='" . PUBLISHER_ADMIN_URL . "/mimetypes.php?op=search' style='margin:0; padding:0;' method='post'>"; echo '<table>'; echo '<tr>'; echo "<td align='right'>" . _AM_PUBLISHER_TEXT_SEARCH_BY . '</td>'; echo "<td align='left'><select name='search_by'>"; foreach ($aSearchBy as $value => $text) { $searchField == $value ? $selected = "selected='selected'" : ($selected = ''); echo "<option value='{$value}' {$selected}>{$text}</option>"; } unset($value, $text); echo '</select></td>'; echo "<td align='right'>" . _AM_PUBLISHER_TEXT_SEARCH_TEXT . '</td>'; echo "<td align='left'><input type='text' name='search_text' id='search_text' value='{$searchText}' /></td>"; echo "<td><input type='submit' name='mime_search' id='mime_search' value='" . _AM_PUBLISHER_BUTTON_SEARCH . "' /></td>"; echo '</tr></table></form></td></tr>'; echo "<tr><td colspan='6'>"; echo "<form action='" . PUBLISHER_ADMIN_URL . "/mimetypes.php?op=search' style='margin:0; padding:0;' method='post'>"; echo "<table width='100%'>"; echo "<tr><td align='right'>" . _AM_PUBLISHER_TEXT_SORT_BY . "\n <select name='sort'>"; foreach ($aSortBy as $value => $text) { $sort == $value ? $selected = "selected='selected'" : ($selected = ''); echo "<option value='{$value}' {$selected}>{$text}</option>"; } unset($value, $text); echo '</select> ' . _AM_PUBLISHER_TEXT_ORDER_BY . "\n <select name='order'>"; foreach ($aOrderBy as $value => $text) { $order == $value ? $selected = "selected='selected'" : ($selected = ''); echo "<option value='{$value}' {$selected}>{$text}</option>"; } unset($value, $text); echo '</select> ' . _AM_PUBLISHER_TEXT_NUMBER_PER_PAGE . "\n <select name='limit'>"; foreach ($aLimitBy as $value => $text) { $limit == $value ? $selected = "selected='selected'" : ($selected = ''); echo "<option value='{$value}' {$selected}>{$text}</option>"; } unset($value, $text); echo "</select>\n <input type='submit' name='mime_sort' id='mime_sort' value='" . _AM_PUBLISHER_BUTTON_SUBMIT . "' />\n <input type='hidden' name='mime_search' id='mime_search' value='1' />\n <input type='hidden' name='search_by' id='search_by' value='{$searchField}' />\n <input type='hidden' name='search_text' id='search_text' value='{$searchText}' />\n </td>\n </tr>"; echo '</table>'; echo '</td></tr>'; if (count($mimetypes) > 0) { echo "<tr><th colspan='6'>" . _AM_PUBLISHER_TEXT_SEARCH_MIME . '</th></tr>'; echo "<tr class='head'>\n <td>" . _AM_PUBLISHER_MIME_ID . '</td> <td>' . _AM_PUBLISHER_MIME_NAME . "</td>\n <td align='center'>" . _AM_PUBLISHER_MIME_EXT . "</td>\n <td align='center'>" . _AM_PUBLISHER_MIME_ADMIN . "</td>\n <td align='center'>" . _AM_PUBLISHER_MIME_USER . "</td>\n <td align='center'>" . _AM_PUBLISHER_MINDEX_ACTION . '</td> </tr>'; foreach ($mimetypes as $mime) { echo "<tr class='even'>\n <td><input type='checkbox' name='mimes[]' value='" . $mime->getVar('mime_id') . "' />" . $mime->getVar('mime_id') . '</td> <td>' . $mime->getVar('mime_name') . "</td>\n <td align='center'>" . $mime->getVar('mime_ext') . "</td>\n <td align='center'>\n <a href='" . PUBLISHER_ADMIN_URL . '/mimetypes.php?op=updateMimeValue&id=' . $mime->getVar('mime_id') . '&mime_admin=' . $mime->getVar('mime_admin') . '&limit=' . $limit . '&start=' . $start . "'>\n " . ($mime->getVar('mime_admin') ? $imagearray['online'] : $imagearray['offline']) . "</a>\n </td>\n <td align='center'>\n <a href='" . PUBLISHER_ADMIN_URL . '/mimetypes.php?op=updateMimeValue&id=' . $mime->getVar('mime_id') . '&mime_user='******'mime_user') . '&limit=' . $limit . '&start=' . $start . "'>\n " . ($mime->getVar('mime_user') ? $imagearray['online'] : $imagearray['offline']) . "</a>\n </td>\n <td align='center'>\n <a href='" . PUBLISHER_ADMIN_URL . '/mimetypes.php?op=edit&id=' . $mime->getVar('mime_id') . '&limit=' . $limit . '&start=' . $start . "'>" . $imagearray['editimg'] . "</a>\n <a href='" . PUBLISHER_ADMIN_URL . '/mimetypes.php?op=delete&id=' . $mime->getVar('mime_id') . '&limit=' . $limit . '&start=' . $start . "'>" . $imagearray['deleteimg'] . '</a> </td> </tr>'; } // unset($mime); echo "<tr class='foot'>\n <td colspan='6' valign='top'>\n <a href='http://www.filext.com' style='float: right;' target='_blank'>" . _AM_PUBLISHER_MIME_FINDMIMETYPE . "</a>\n <input type='checkbox' name='checkAllMimes' value='0' onclick='selectAll(this.form,\"mimes[]\",this.checked);' />\n <input type='submit' name='deleteMimes' id='deleteMimes' value='" . _AM_PUBLISHER_BUTTON_DELETE . "' />\n <input type='submit' name='add_mime' id='add_mime' value='" . _AM_PUBLISHER_MIME_CREATEF . "' class='formButton' />\n </td>\n </tr>"; } else { echo '<tr><th>' . _AM_PUBLISHER_TEXT_SEARCH_MIME . '</th></tr>'; echo "<tr class='even'>\n <td>" . _AM_PUBLISHER_TEXT_NO_RECORDS . '</td> </tr>'; } echo '</table>'; echo "<div id='pagenav'>" . $nav->renderNav() . '</div>'; } publisherCloseCollapsableBar('mimesearchtable', 'mimesearchicon'); // include_once __DIR__ . '/admin_footer.php'; xoops_cp_footer(); }
case "expire": $sort = "mod_end"; $order = "DESC"; break; //case "expire": default: $sort = "forum_id ASC, uid ASC, ip"; $order = "ASC"; break; } $criteria = new Criteria("forum_id", "(0, ".$forum_id.")", "IN"); $criteria->setLimit($xoopsModuleConfig['topics_per_page']); $criteria->setStart($start); $criteria->setSort($sort); $criteria->setOrder($order); $moderate_objs =& $moderate_handler->getObjects($criteria); $moderate_count = $moderate_handler->getCount($criteria); include XOOPS_ROOT_PATH.'/header.php'; if($forum_id){ $url = 'viewforum.php?forum='.$forum_id; }else{ $url = 'index.php'; } echo '<div style="padding: 10px; margin-left:auto; margin-right:auto; text-align:center;"><a href="'.$url.'"><h2>'._MD_SUSPEND_MANAGEMENT.'</h2></a></div>'; if(!empty($moderate_count)){ $_users = array(); foreach(array_keys($moderate_objs) as $id){ $_users[$moderate_objs[$id]->getVar("uid")] = 1;
/** * This is a kind of getObjects(). Return objects that were modified recently. * * @param $limit int * @return array array of the object */ function &getRecentModifyFile($limit = 10) { $criteria = new Criteria('tpl_id', 0, '>'); $criteria->setLimit($limit); $criteria->setSort('tpl_lastmodified'); $criteria->setOrder('DESC'); $objs =& $this->getObjects($criteria); return $objs; }
function xoonips_transfer_get_index_tree_for_dropdown($index_id, &$result, $depth) { $index_compo_handler =& xoonips_getormcompohandler('xoonips', 'index'); $index_compo = $index_compo_handler->get($index_id); if ($index_compo === false) { return; // bad index_id } $titles = $index_compo->getVar('titles'); $index_item_link_handler =& xoonips_getormhandler('xoonips', 'index_item_link'); $result[] = array('index_id' => $index_id, 'title' => $titles[DEFAULT_INDEX_TITLE_OFFSET]->get('title'), 'depth' => $depth, 'item_count' => $index_item_link_handler->getCount(new Criteria('index_id', $index_id))); $index_handler =& xoonips_getormhandler('xoonips', 'index'); $index = $index_compo->getVar('index'); $criteria = new Criteria('parent_index_id', $index_id); $criteria->setOrder('asc'); $criteria->setSort('sort_number'); $indexes =& $index_handler->getObjects($criteria); if ($indexes !== false) { foreach ($indexes as $index) { xoonips_transfer_get_index_tree_for_dropdown($index->get('index_id'), $result, $depth + 1); } } }
} $size = count($clean_msg_id); $msg =& $clean_msg_id; for ($i = 0; $i < $size; ++$i) { $pm = $pm_handler->get((int) $msg[$i]); if ($pm->getVar('to_userid') == $xoops->user->getVar('uid')) { $pm_handler->delete($pm); } unset($pm); } $xoops->redirect("viewpmsg.php", 1, XoopsLocale::S_YOUR_MESSAGES_DELETED); } $xoops->header('module:system/system_viewpmsg.tpl'); $criteria = new Criteria('to_userid', $xoops->user->getVar('uid')); $criteria->setSort('msg_time'); $criteria->setOrder('DESC'); $pm_arr = $pm_handler->getObjects($criteria); $total_messages = count($pm_arr); $xoops->tpl()->assign('display', true); $xoops->tpl()->assign('anonymous', $xoops->getConfig('anonymous')); $xoops->tpl()->assign('uid', $xoops->user->getVar("uid")); $xoops->tpl()->assign('total_messages', $total_messages); $msg_no = 0; foreach (array_keys($pm_arr) as $i) { $messages['msg_id'] = $pm_arr[$i]->getVar("msg_id"); $messages['read_msg'] = $pm_arr[$i]->getVar("read_msg"); $messages['msg_image'] = $pm_arr[$i]->getVar("msg_image"); $messages['posteruid'] = $pm_arr[$i]->getVar('from_userid'); $messages['postername'] = XoopsUser::getUnameFromId($pm_arr[$i]->getVar('from_userid')); $messages['subject'] = $pm_arr[$i]->getVar("subject"); $messages['msg_time'] = XoopsLocale::formatTimestamp($pm_arr[$i]->getVar('msg_time'));
function manageDepartments() { global $xoopsModule, $oAdminButton, $aSortBy, $aOrderBy, $aLimitBy, $order, $limit, $start, $sort, $dept_search; $module_id = $xoopsModule->getVar('mid'); $hGroups =& xoops_gethandler('group'); $hGroupPerm =& xoops_gethandler('groupperm'); if (isset($_POST['addDept'])) { $hasErrors = false; $errors = array(); $groups = isset($_POST['groups']) ? $_POST['groups'] : array(); $hDepartments =& xhelpGetHandler('department'); //Department Name supplied? if (trim($_POST['newDept']) == '') { $hasErrors = true; $errors['newDept'][] = _AM_XHELP_MESSAGE_NO_DEPT; } else { //Department Name unique? $crit = new Criteria('department', $_POST['newDept']); if ($existingDepts = $hDepartments->getCount($crit)) { $hasErrors = true; $errors['newDept'][] = _XHELP_MESSAGE_DEPT_EXISTS; } } if ($hasErrors) { $session =& Session::singleton(); //Store existing dept info in session, reload addition page $aDept = array(); $aDept['newDept'] = $_POST['newDept']; $aDept['groups'] = $groups; $session->set('xhelp_addDepartment', $aDept); $session->set('xhelp_addDepartmentErrors', $errors); header('Location: ' . xhelpMakeURI(XHELP_ADMIN_URL . '/department.php', array('op' => 'manageDepartments'), false)); exit; } $department =& $hDepartments->create(); $department->setVar('department', $_POST['newDept']); if ($hDepartments->insert($department)) { $deptID = $department->getVar('id'); foreach ($groups as $group) { // Add new group permissions $hGroupPerm->addRight(_XHELP_GROUP_PERM_DEPT, $deptID, $group, $module_id); } // Set as default department? if (isset($_POST['defaultDept']) && $_POST['defaultDept'] == 1) { xhelpSetMeta("default_department", $deptID); } $hStaff =& xhelpGetHandler('staff'); $allDeptStaff =& $hStaff->getByAllDepts(); if (count($allDeptStaff) > 0) { $hMembership =& xhelpGetHandler('membership'); if ($hMembership->addStaffToDept($allDeptStaff, $department->getVar('id'))) { $message = _XHELP_MESSAGE_ADD_DEPT; } else { $message = _AM_XHELP_MESSAGE_STAFF_UPDATE_ERROR; } } else { $message = _XHELP_MESSAGE_ADD_DEPT; } // Add configoption for new department $hConfig =& xoops_gethandler('config'); $hConfigOption =& xoops_gethandler('configoption'); $crit = new Criteria('conf_name', 'xhelp_defaultDept'); $config =& $hConfig->getConfigs($crit); if (count($config) > 0) { $newOption =& $hConfigOption->create(); $newOption->setVar('confop_name', $department->getVar('department')); $newOption->setVar('confop_value', $department->getVar('id')); $newOption->setVar('conf_id', $config[0]->getVar('conf_id')); if (!$hConfigOption->insert($newOption)) { redirect_header(XHELP_ADMIN_URL . "/department.php?op=manageDepartments", 3, _AM_XHELP_MSG_ADD_CONFIG_ERR); } } _clearAddSessionVars(); header("Location: " . XHELP_ADMIN_URL . "/department.php?op=manageDepartments"); } else { $message = _XHELP_MESSAGE_ADD_DEPT_ERROR . $department->getHtmlErrors(); } $deptID = $department->getVar('id'); /* Not sure if this is needed. Already exists in if block above (ej) foreach($groups as $group){ $hGroupPerm->addRight(_XHELP_GROUP_PERM_DEPT, $deptID, $group, $module_id); } */ redirect_header(XHELP_ADMIN_URL . '/department.php?op=manageDepartments', 3, $message); } else { $hDepartments =& xhelpGetHandler('department'); if ($dept_search == false) { $crit = new Criteria('', ''); } else { $crit = new Criteria('department', "%{$dept_search}%", 'LIKE'); } $crit->setOrder($order); $crit->setSort($sort); $crit->setLimit($limit); $crit->setStart($start); $total = $hDepartments->getCount($crit); $departmentInfo =& $hDepartments->getObjects($crit); $nav = new XoopsPageNav($total, $limit, $start, 'start', "op=manageDepartments&limit={$limit}"); // Get list of all groups $crit = new Criteria('', ''); $crit->setSort('name'); $crit->setOrder('ASC'); $groups =& $hGroups->getObjects($crit, true); $aGroups = array(); foreach ($groups as $group_id => $group) { $aGroups[$group_id] = $group->getVar('name'); } asort($aGroups); // Set groups in alphabetical order xoops_cp_header(); echo $oAdminButton->renderButtons('manDept'); $session =& Session::singleton(); $sess_dept = $session->get('xhelp_addDepartment'); $sess_errors = $session->get('xhelp_addDepartmentErrors'); //Display any form errors if (!$sess_errors === false) { xhelpRenderErrors($sess_errors, xhelpMakeURI(XHELP_ADMIN_URL . '/department.php', array('op' => 'clearAddSession'), false)); } if (!$sess_dept === false) { $fld_newDept = $sess_dept['newDept']; $fld_groups = $sess_dept['groups']; } else { $fld_newDept = ''; $fld_groups = array(); } echo "<form method='post' action='" . XHELP_ADMIN_URL . "/department.php?op=manageDepartments'>"; echo "<table width='100%' cellspacing='1' class='outer'>\r\n <tr><th colspan='2'><label for='newDept'>" . _AM_XHELP_LINK_ADD_DEPT . " </label></th></tr>"; echo "<tr><td class='head' width='20%' valign='top'>" . _AM_XHELP_TEXT_NAME . "</td><td class='even'>"; echo "<input type='text' id='newDept' name='newDept' class='formButton' value='{$fld_newDept}' /></td></tr>"; echo "<tr><td class='head' width='20%' valign='top'>" . _AM_XHELP_TEXT_EDIT_DEPT_PERMS . "</td><td class='even'>"; echo "<select name='groups[]' multiple='multiple'>"; foreach ($aGroups as $group_id => $group) { if (in_array($group_id, $fld_groups, true)) { echo "<option value='{$group_id}' selected='selected'>{$group}</option>"; } else { echo "<option value='{$group_id}'>{$group}</option>"; } } echo "</select></td></tr>"; echo "<tr><td class='head' width='20%' valign='top'>" . _AM_XHELP_TEXT_DEFAULT_DEPT . "?</td>\r\n <td class='even'><input type='checkbox' name='defaultDept' id='defaultDept' value='1' /></td></tr>"; echo "<tr><td class='foot' colspan='2'><input type='submit' name='addDept' value='" . _AM_XHELP_BUTTON_SUBMIT . "' class='formButton' /></td></tr>"; echo "</table><br />"; echo "</form>"; if ($total > 0) { // Make sure there are departments echo "<form action='" . XHELP_ADMIN_URL . "/department.php?op=manageDepartments' style='margin:0; padding:0;' method='post'>"; echo "<table width='100%' cellspacing='1' class='outer'>"; echo "<tr><td align='right'>" . _AM_XHELP_BUTTON_SEARCH . "\r\n <input type='text' name='dept_search' value='{$dept_search}'/>\r\n \r\n " . _AM_XHELP_TEXT_SORT_BY . "\r\n <select name='sort'>"; foreach ($aSortBy as $value => $text) { $sort == $value ? $selected = "selected='selected'" : ($selected = ''); echo "<option value='{$value}' {$selected}>{$text}</option>"; } echo "</select>\r\n \r\n " . _AM_XHELP_TEXT_ORDER_BY . "\r\n <select name='order'>"; foreach ($aOrderBy as $value => $text) { $order == $value ? $selected = "selected='selected'" : ($selected = ''); echo "<option value='{$value}' {$selected}>{$text}</option>"; } echo "</select>\r\n \r\n " . _AM_XHELP_TEXT_NUMBER_PER_PAGE . "\r\n <select name='limit'>"; foreach ($aLimitBy as $value => $text) { $limit == $value ? $selected = "selected='selected'" : ($selected = ''); echo "<option value='{$value}' {$selected}>{$text}</option>"; } echo "</select>\r\n <input type='submit' name='dept_sort' id='dept_sort' value='" . _AM_XHELP_BUTTON_SUBMIT . "' />\r\n </td>\r\n </tr>"; echo "</table></form>"; echo "<table width='100%' cellspacing='1' class='outer'>\r\n <tr><th colspan='4'>" . _AM_XHELP_EXISTING_DEPARTMENTS . "</th></tr>\r\n <tr><td class='head'>" . _AM_XHELP_TEXT_ID . "</td><td class='head'>" . _AM_XHELP_TEXT_DEPARTMENT . "</td><td class='head'>" . _AM_XHELP_TEXT_DEFAULT . "</td><td class='head'>" . _AM_XHELP_TEXT_ACTIONS . "</td></tr>"; if (isset($departmentInfo)) { $defaultDept = xhelpGetMeta("default_department"); foreach ($departmentInfo as $dept) { echo "<tr><td class='even'>" . $dept->getVar('id') . "</td><td class='even'>" . $dept->getVar('department') . "</td>"; if ($dept->getVar('id') != $defaultDept) { echo "<td class='even' width='10%'><a href='" . XHELP_ADMIN_URL . "/department.php?op=updateDefault&id=" . $dept->getVar('id') . "'><img src='" . XHELP_IMAGE_URL . "/off.png' alt='" . _AM_XHELP_TEXT_MAKE_DEFAULT_DEPT . "' title='" . _AM_XHELP_TEXT_MAKE_DEFAULT_DEPT . "' /></a></td>"; } else { echo "<td class='even' width='10%'><img src='" . XHELP_IMAGE_URL . "/on.png'</td>"; } //echo "<td class='even' width='10%'><img src='".XHELP_IMAGE_URL."/". (($dept->getVar('id') == $defaultDept) ? "on.png" : "off.png")."'</td>"; echo "<td class='even' width='70'><a href='" . XHELP_ADMIN_URL . "/department.php?op=editDepartment&deptid=" . $dept->getVar('id') . "'><img src='" . XOOPS_URL . "/modules/xhelp/images/button_edit.png' title='" . _AM_XHELP_TEXT_EDIT . "' name='editDepartment' /></a> "; echo "<a href='" . XHELP_ADMIN_URL . "/delete.php?deleteDept=1&deptid=" . $dept->getVar('id') . "'><img src='" . XOOPS_URL . "/modules/xhelp/images/button_delete.png' title='" . _AM_XHELP_TEXT_DELETE . "' name='deleteDepartment' /></a></td></tr>"; } } } echo "</td></tr></table>"; echo "<div id='dept_nav'>" . $nav->renderNav() . "</div>"; xhelpAdminFooter(); xoops_cp_footer(); } }
function createStaffGlobalLists($uid) { $hSavedSearches =& xhelpGetHandler('savedSearch'); $uid = intval($uid); $crit = new Criteria('uid', XHELP_GLOBAL_UID); $crit->setSort('id'); $crit->setOrder('ASC'); $globalSearches =& $hSavedSearches->getObjects($crit, true); $i = 1; foreach ($globalSearches as $search) { $list =& $this->create(); $list->setVar('uid', $uid); $list->setVar('searchid', $search->getVar('id')); $list->setVar('weight', $i); $ret = $this->insert($list, true); $i++; } return $ret; }
} if ($afftit == '1') { $form2 .= "<br /><center><font size=4>" . $title . "</font></center><br />"; } else { $form2 .= ''; } } } include_once XOOPS_ROOT_PATH . "/modules/" . $modversion['dirname'] . "/upload_FA.php"; if (empty($_POST['submit'])) { $j = 0; include_once XOOPS_ROOT_PATH . "/class/xoopsformloader.php"; include_once XOOPS_ROOT_PATH . '/header.php'; $criteria = new Criteria('ele_display', 1); $criteria->setSort('ele_order'); $criteria->setOrder('ASC'); $elements =& $formulaire_mgr->getObjects2($criteria, $id); if ($qcm == '1') { $urlsuite = XOOPS_URL . '/modules/' . $modversion["dirname"] . '/formulaire.php?id=' . $id . '&qcm=1'; } else { $urlsuite = XOOPS_URL . '/modules/' . $modversion["dirname"] . '/formulaire.php?id=' . $id . '&qcm=0'; } $form = new XoopsThemeForm($form2, $modversion["dirname"], $urlsuite); $form->setExtra("enctype='multipart/form-data'"); // impératif ! include_once XOOPS_ROOT_PATH . "/class/uploader.php"; if (!empty($_POST['event_id']) && !empty($_POST['event_title'])) { // aus pical kommend $picalid = new XoopsFormHidden('pical_eventid', intval($_POST['event_id'])); $form->addElement($picalid); $picalid2 = new XoopsFormHidden('pical_eventtext', trim($_POST['event_title']));
function manageStatus() { global $oAdminButton, $aSortBy, $aOrderBy, $aLimitBy, $order, $limit, $start, $sort; $hStatus =& xhelpGetHandler('status'); if (isset($_POST['changeDefaultStatus'])) { xhelpSetMeta("default_status", $_POST['default']); } if (isset($_POST['newStatus'])) { if ($_POST['desc'] == '') { // If no description supplied $message = _AM_XHELP_MESSAGE_NO_DESC; redirect_header(XHELP_ADMIN_URL . "/status.php?op=manageStatus", 3, $message); } $newStatus =& $hStatus->create(); $newStatus->setVar('state', intval($_POST['state'])); $newStatus->setVar('description', $_POST['desc']); if ($hStatus->insert($newStatus)) { header("Location: " . XHELP_ADMIN_URL . "/status.php?op=manageStatus"); } else { $message = _AM_MESSAGE_ADD_STATUS_ERR; redirect_header(XHELP_ADMIN_URL . "/status.php?op=manageStatus", 3, $message); } } xoops_cp_header(); echo $oAdminButton->renderButtons('manStatus'); echo "<form method='post' action='" . XHELP_ADMIN_URL . "/status.php?op=manageStatus'>"; echo "<table width='100%' cellspacing='1' class='outer'>\r\n <tr><th colspan='2'><label>" . _AM_XHELP_TEXT_ADD_STATUS . "</label></th></tr>"; echo "<tr><td class='head' width='20%'>" . _AM_XHELP_TEXT_DESCRIPTION . "</td>\r\n <td class='even'>\r\n <input type='text' name='desc' value='' class='formButton' />\r\n </td>\r\n </tr>"; echo "<tr><td class='head' width='20%'>" . _AM_XHELP_TEXT_STATE . "</td><td class='even'>\r\n <select name='state'>\r\n <option value='1'>" . xhelpGetState(1) . "</option>\r\n <option value='2'>" . xhelpGetState(2) . "</option>\r\n </select></td></tr>"; echo "<tr><td class='foot' colspan='2'><input type='submit' name='newStatus' value='" . _AM_XHELP_TEXT_ADD_STATUS . "' class='formButton' /></td></tr>"; echo "</table></form>"; // Get list of existing statuses $crit = new Criteria('', ''); $crit->setOrder($order); $crit->setSort($sort); $crit->setLimit($limit); $crit->setStart($start); $statuses =& $hStatus->getObjects($crit); $total = $hStatus->getCount($crit); $aStatuses = array(); foreach ($statuses as $status) { $aStatuses[$status->getVar('id')] = $status->getVar('description'); } if (!($default_status = xhelpGetMeta("default_status"))) { xhelpSetMeta("default_status", "1"); $default_status = 1; } $form = new xhelpForm(_AM_XHELP_TEXT_DEFAULT_STATUS, 'default_status', xhelpMakeURI(XHELP_ADMIN_URL . '/status.php', array('op' => 'manageStatus'))); $status_select = new XoopsFormSelect(_AM_XHELP_TEXT_STATUS, 'default', $default_status); $status_select->addOptionArray($aStatuses); $btn_tray = new XoopsFormElementTray(''); $btn_tray->addElement(new XoopsFormButton('', 'changeDefaultStatus', _AM_XHELP_BUTTON_SUBMIT, 'submit')); $form->addElement($status_select); $form->addElement($btn_tray); $form->setLabelWidth('20%'); echo $form->render(); $nav = new XoopsPageNav($total, $limit, $start, 'start', "op=manageStatus&limit={$limit}"); echo "<form action='" . XHELP_ADMIN_URL . "/status.php?op=manageStatus' style='margin:0; padding:0;' method='post'>"; echo "<table width='100%' cellspacing='1' class='outer'>"; echo "<tr><td align='right'>" . _AM_XHELP_TEXT_SORT_BY . "\r\n <select name='sort'>"; foreach ($aSortBy as $value => $text) { $sort == $value ? $selected = "selected='selected'" : ($selected = ''); echo "<option value='{$value}' {$selected}>{$text}</option>"; } echo "</select>\r\n \r\n " . _AM_XHELP_TEXT_ORDER_BY . "\r\n <select name='order'>"; foreach ($aOrderBy as $value => $text) { $order == $value ? $selected = "selected='selected'" : ($selected = ''); echo "<option value='{$value}' {$selected}>{$text}</option>"; } echo "</select>\r\n \r\n " . _AM_XHELP_TEXT_NUMBER_PER_PAGE . "\r\n <select name='limit'>"; foreach ($aLimitBy as $value => $text) { $limit == $value ? $selected = "selected='selected'" : ($selected = ''); echo "<option value='{$value}' {$selected}>{$text}</option>"; } echo "</select>\r\n <input type='submit' name='status_sort' id='status_sort' value='" . _AM_XHELP_BUTTON_SUBMIT . "' />\r\n </td>\r\n </tr>"; echo "</table></form>"; echo "<table width='100%' cellspacing='1' class='outer'>\r\n <tr><th colspan='4'><label>" . _AM_XHELP_TEXT_MANAGE_STATUSES . "</label></th></tr>"; echo "<tr class='head'>\r\n <td>" . _AM_XHELP_TEXT_ID . "</td>\r\n <td>" . _AM_XHELP_TEXT_DESCRIPTION . "</td>\r\n <td>" . _AM_XHELP_TEXT_STATE . "</td>\r\n <td>" . _AM_XHELP_TEXT_ACTIONS . "</td>\r\n </tr>"; foreach ($statuses as $status) { echo "<tr class='even'><td>" . $status->getVar('id') . "</td><td>" . $status->getVar('description') . "</td>\r\n <td>" . xhelpGetState($status->getVar('state')) . "</td>\r\n <td>\r\n <a href='status.php?op=editStatus&statusid=" . $status->getVar('id') . "'><img src='" . XHELP_IMAGE_URL . "/button_edit.png' title='" . _AM_XHELP_TEXT_EDIT . "' name='editStatus' /></a> \r\n <a href='status.php?op=deleteStatus&statusid=" . $status->getVar('id') . "'><img src='" . XHELP_IMAGE_URL . "/button_delete.png' title='" . _AM_XHELP_TEXT_DELETE . "' name='deleteStatus' /></a></td></tr>\r\n </td></tr>"; } echo "</table>"; echo "<div id='status_nav'>" . $nav->renderNav() . "</div>"; xhelpAdminFooter(); xoops_cp_footer(); }
/** * Retourne la dernière commande d'un utilisateur (si elle existe) * * @param integer $uid Identifiant de la commande */ function getLastUserOrder($uid) { $order = null; $orders = array(); $criteria = new Criteria('cmd_uid', $uid, '='); $criteria->setSort('cmd_date'); $criteria->setOrder('DESC'); $criteria->setLimit(1); $orders = $this->getObjects($criteria, false); if (count($orders) > 0) { $order = $orders[0]; } return $order; }
$showcomments = get_param('showcomments'); $commentend = $commentstart + $showcomments - 1; } $nextXstart = $commentend + 1; $nextXend = $nextXstart + $showcomments - 1; $previousXstart = $commentstart - $showcomments; $previousXend = $commentend - $showcomments; if ($previousXstart < 1) { $previousXstart = 0; $previousXend = 0; } $selorder_desc = selected($commentorder, "DESC", false); $selorder_asc = selected($commentorder, "ASC", false); $criteria = new Criteria(1, 1); $criteria->setSort('comment_date'); $criteria->setOrder($commentorder); $criteria->setStart($commentstart - 1); $criteria->setLimit($commentend - $commentstart + 1); $commentHandler =& wp_handler('Comment'); $commentObjects =& $commentHandler->getObjects($criteria); $comment_rows = array(); if ($commentObjects) { $comments_found = true; foreach ($commentObjects as $commentObject) { $row = $commentObject->getVarArray(); $comment = $commentObject->exportWpObject(); //$comment global is used in template_functions. if ($commentObject->getVar('comment_approved') == 0) { $row['class'] = 'class="unapproved" '; } else { $row['class'] = '';
function b_xhelp_actions_show() { $_xhelpSession = new Session(); global $ticketInfo, $xoopsUser, $xoopsModule, $xoopsModuleConfig, $ticketInfo, $staff, $xoopsConfig; $module_handler =& xoops_gethandler('module'); $config_handler =& xoops_gethandler('config'); $member_handler =& xoops_gethandler('member'); $hTickets =& xhelpGetHandler('ticket'); $hMembership =& xhelpGetHandler('membership'); $hStaff =& xhelpGetHandler('staff'); $hDepartment =& xhelpGetHandler('department'); //Don't show block for anonymous users or for non-staff members if (!$xoopsUser) { return false; } //Don't show block if outside the xhelp module' if (!isset($xoopsModule) || $xoopsModule->getVar('dirname') != 'xhelp') { return false; } $block = array(); $myPage = $_SERVER['PHP_SELF']; $currentPage = substr(strrchr($myPage, "/"), 1); if ($currentPage != 'ticket.php' || $xoopsModuleConfig['xhelp_staffTicketActions'] != 2) { return false; } if (isset($_GET['id'])) { $block['ticketid'] = intval($_GET['id']); } else { return false; } //Use Global $ticketInfo object (if exists) if (!isset($ticketInfo)) { $ticketInfo =& $hTickets->get($block['ticketid']); } if ($xoopsModuleConfig['xhelp_staffTicketActions'] == 2) { $aOwnership = array(); $aOwnership[] = array('uid' => 0, 'uname' => _XHELP_NO_OWNER); if (isset($staff)) { foreach ($staff as $stf) { //** BTW - Need to have a way to get all XoopsUser objects for the staff in 1 shot //$own =& $member_handler->getUser($stf->getVar('uid')); // Create user object $aOwnership[] = array('uid' => $stf->getVar('uid'), 'uname' => ''); $all_users[$stf->getVar('uid')] = ''; } } else { return false; } $xoopsDB =& Database::getInstance(); $users = array(); //@Todo - why is this query here instead of using a function or the XoopsMemberHandler? $sql = sprintf("SELECT uid, uname, name FROM %s WHERE uid IN (%s)", $xoopsDB->prefix('users'), implode(array_keys($all_users), ',')); $ret = $xoopsDB->query($sql); $displayName = $xoopsModuleConfig['xhelp_displayName']; while ($member = $xoopsDB->fetchArray($ret)) { if ($displayName == 2 && $member['name'] != '') { $users[$member['uid']] = $member['name']; } else { $users[$member['uid']] = $member['uname']; } } for ($i = 0; $i < count($aOwnership); $i++) { if (isset($users[$aOwnership[$i]['uid']])) { $aOwnership[$i]['uname'] = $users[$aOwnership[$i]['uid']]; } } $block['ownership'] = $aOwnership; } $block['imagePath'] = XHELP_IMAGE_URL . '/'; $block['xhelp_priorities'] = array(1, 2, 3, 4, 5); $block['xhelp_priorities_desc'] = array('5' => _XHELP_PRIORITY5, '4' => _XHELP_PRIORITY4, '3' => _XHELP_PRIORITY3, '2' => _XHELP_PRIORITY2, '1' => _XHELP_PRIORITY1); $block['ticket_priority'] = $ticketInfo->getVar('priority'); $block['ticket_status'] = $ticketInfo->getVar('status'); $block['xhelp_status0'] = _XHELP_STATUS0; $block['xhelp_status1'] = _XHELP_STATUS1; $block['xhelp_status2'] = _XHELP_STATUS2; $block['ticket_ownership'] = $ticketInfo->getVar('ownership'); $block['xhelp_has_changeOwner'] = false; if ($ticketInfo->getVar('uid') == $xoopsUser->getVar('uid')) { $block['xhelp_has_addResponse'] = true; } else { $block['xhelp_has_addResponse'] = false; } $block['xhelp_has_editTicket'] = false; $block['xhelp_has_deleteTicket'] = false; $block['xhelp_has_changePriority'] = false; $block['xhelp_has_changeStatus'] = false; $block['xhelp_has_editResponse'] = false; $block['xhelp_has_mergeTicket'] = false; $rowspan = 2; $checkRights = array(XHELP_SEC_TICKET_OWNERSHIP => array('xhelp_has_changeOwner', false), XHELP_SEC_RESPONSE_ADD => array('xhelp_has_addResponse', false), XHELP_SEC_TICKET_EDIT => array('xhelp_has_editTicket', true), XHELP_SEC_TICKET_DELETE => array('xhelp_has_deleteTicket', true), XHELP_SEC_TICKET_MERGE => array('xhelp_has_mergeTicket', true), XHELP_SEC_TICKET_PRIORITY => array('xhelp_has_changePriority', false), XHELP_SEC_TICKET_STATUS => array('xhelp_has_changeStatus', false), XHELP_SEC_RESPONSE_EDIT => array('xhelp_has_editResponse', false), XHELP_SEC_FILE_DELETE => array('xhelp_has_deleteFile', false), XHELP_SEC_FAQ_ADD => array('xhelp_has_addFaq', false), XHELP_SEC_TICKET_TAKE_OWNERSHIP => array('xhelp_has_takeOwnership', false)); $checkStaff =& $hStaff->getByUid($xoopsUser->getVar('uid')); // See if this user is accepted for this ticket $hTicketEmails =& xhelpGetHandler('ticketEmails'); $crit = new CriteriaCompo(new Criteria('ticketid', $ticketInfo->getVar('id'))); $crit->add(new Criteria('uid', $xoopsUser->getVar('uid'))); $ticketEmails =& $hTicketEmails->getObjects($crit); //Retrieve all departments $crit = new Criteria('', ''); $crit->setSort('department'); $alldepts = $hDepartment->getObjects($crit); $aDept = array(); foreach ($alldepts as $dept) { $aDept[$dept->getVar('id')] = $dept->getVar('department'); } unset($alldepts); $block['departments'] =& $aDept; $block['departmentid'] = $ticketInfo->getVar('department'); foreach ($checkRights as $right => $desc) { if ($right == XHELP_SEC_RESPONSE_ADD && count($ticketEmails > 0)) { $block[$desc[0]] = true; continue; } if ($right == XHELP_SEC_TICKET_STATUS && count($ticketEmails > 0)) { $block[$desc[0]] = true; continue; } if ($hasRights = $checkStaff->checkRoleRights($right, $ticketInfo->getVar('department'))) { $block[$desc[0]] = true; if ($desc[1]) { $rowspan++; } } } $block['xhelp_actions_rowspan'] = $rowspan; $hStatus =& xhelpGetHandler('status'); $crit = new Criteria('', ''); $crit->setSort('description'); $crit->setOrder('ASC'); $statuses =& $hStatus->getObjects($crit); $aStatuses = array(); foreach ($statuses as $status) { $aStatuses[$status->getVar('id')] = array('id' => $status->getVar('id'), 'desc' => $status->getVar('description'), 'state' => $status->getVar('state')); } $block['statuses'] = $aStatuses; return $block; }
// compile a list of data-entry screens for this form $options['subform_screens'] = array(); $screen_options = q("SELECT sid, title FROM " . $xoopsDB->prefix("formulize_screen") . " WHERE fid=" . intval($formtouse) . " and type='form'"); $options['subform_screens'][0] = "(Use Default Screen)"; foreach ($screen_options as $screen_option) { $options['subform_screens'][$screen_option["sid"]] = $screen_option["title"]; } // setup the UI for the subform conditions filter $options['subformfilter'] = formulize_createFilterUI($ele_value[7], "subformfilter", $ele_value[0], "form-2"); } elseif ($ele_type == "grid") { $options['background'] = $ele_value[3]; $options['heading'] = $ele_value[0]; $options['sideortop'] = $ele_value[5] == 1 ? "side" : "above"; $grid_elements_criteria = new Criteria(); $grid_elements_criteria->setSort('ele_order'); $grid_elements_criteria->setOrder('ASC'); $grid_elements = $element_handler->getObjects($grid_elements_criteria, $fid); foreach ($grid_elements as $this_element) { $grid_start_options[$this_element->getVar('ele_id')] = $this_element->getVar('ele_colhead') ? printSmart(trans($this_element->getVar('ele_colhead'))) : printSmart(trans($this_element->getVar('ele_caption'))); } $options['grid_start_options'] = $grid_start_options; } elseif ($ele_type == "radio") { $ele_value = formulize_mergeUIText($ele_value, $ele_uitext); $options['useroptions'] = $ele_value; } elseif ($ele_type == "checkbox") { $ele_value = formulize_mergeUIText($ele_value, $ele_uitext); $options['useroptions'] = $ele_value; } elseif ($ele_type == "select") { if ($ele_id == "new") { $options['listordd'] = 0; $options['multiple'] = 0;
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // // GNU General Public License for more details. // // // // You should have received a copy of the GNU General Public License // // along with this program; if not, write to the Free Software // // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // // ------------------------------------------------------------------------ // include_once '../../mainfile.php'; $xoopsOption['template_main'] = 'yogurt_scrapbook.html'; include_once '../../header.php'; include_once 'class/yogurt_controler.php'; $controler = new YogurtControlerScraps($xoopsDB, $xoopsUser); $nbSections = $controler->getNumbersSections(); //$controler->renderFormNewPost($xoopsTpl); $criteria_uid = new Criteria('scrap_to', $controler->uidOwner); $criteria_uid->setOrder('DESC'); $criteria_uid->setSort('date'); /** * Adding to the module js and css of the lightbox and new ones */ $xoTheme->addStylesheet(XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/include/yogurt.css'); $xoTheme->addStylesheet(XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/css/jquery.tabs.css'); // what browser they use if IE then add corrective script. if (ereg('msie', strtolower($_SERVER['HTTP_USER_AGENT']))) { $xoTheme->addStylesheet(XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/css/jquery.tabs-ie.css'); } //$xoTheme->addStylesheet(XOOPS_URL.'/modules/'.$xoopsModule->getVar('dirname').'/lightbox/css/lightbox.css'); //$xoTheme->addScript(XOOPS_URL.'/modules/'.$xoopsModule->getVar('dirname').'/lightbox/js/prototype.js'); //$xoTheme->addScript(XOOPS_URL.'/modules/'.$xoopsModule->getVar('dirname').'/lightbox/js/scriptaculous.js?load=effects'); //$xoTheme->addScript(XOOPS_URL.'/modules/'.$xoopsModule->getVar('dirname').'/lightbox/js/lightbox.js'); //$xoTheme->addStylesheet(XOOPS_URL.'/modules/'.$xoopsModule->getVar('dirname').'/include/jquery.lightbox-0.3.css');