/**
  * 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 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;
 }
function item_get_userlist($upage)
{
    global $xoopsDB;
    global $xoopsUser;
    // myuid
    $myuid = $xoopsUser->getVar('uid', 'n');
    $xusers_handler =& xoonips_getormhandler('xoonips', 'users');
    $tables['users'] = $xoopsDB->prefix('users');
    $tables['xusers'] = $xoopsDB->prefix('xoonips_users');
    $join_criteria = new XooNIpsJoinCriteria('users', 'uid', 'uid');
    $criteria = new Criteria($tables['users'] . '.level', 0, '>');
    $criteria->setSort($tables['users'] . '.uname');
    $fields = array();
    $fields[] = $tables['xusers'] . '.uid';
    $fields[] = $tables['users'] . '.uname';
    $xusers_objs =& $xusers_handler->getObjects($criteria, false, implode(',', $fields), false, $join_criteria);
    $textutil =& xoonips_getutility('text');
    $users = array();
    $users[] = array('uid' => 0, 'uname' => $textutil->html_special_chars(_AM_XOONIPS_MAINTENANCE_ITEM_LABEL_ALLUSERS), 'selected' => 'selected="selected"');
    foreach ($xusers_objs as $xusers_obj) {
        $uid = $xusers_obj->getVar('uid', 'e');
        $uname = $textutil->html_special_chars($xusers_obj->getExtraVar('uname'));
        $users[] = array('uid' => $uid, 'uname' => $uname, 'selected' => '');
    }
    return $users;
}
 /**
  * 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);
 }
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;
}
 /**
  * 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);
 }
 /**
  * @brief search file
  *
  * @param query query
  * @param limit the maximum number of rows to return
  * @param offset the offset of the first row to return
  * @param uid user ID
  * @return array of item id
  */
 function search($query, $limit, $offset, $uid)
 {
     $msg = false;
     $iids = false;
     $dummy = false;
     $search_cache_id = false;
     $_SESSION['XNPSID'] = session_id();
     $member_handler =& xoops_gethandler('member');
     if (empty($GLOBALS['xoopsUser'])) {
         $GLOBALS['xoopsUser'] = $member_handler->getUser($uid);
     }
     if (xnpSearchExec('quicksearch', $query, 'all', false, $dummy, $dummy, $dummy, $search_cache_id, false, 'file')) {
         // search_cache_id -> file_ids
         $criteria = new Criteria('search_cache_id', $search_cache_id);
         $criteria->setSort('item_id');
         $criteria->setStart($offset);
         if ($limit) {
             $criteria->setLimit($limit);
         }
         $join = new XooNIpsJoinCriteria('xoonips_search_cache_file', 'file_id', 'file_id', 'LEFT');
         $file_handler =& xoonips_getormhandler('xoonips', 'file');
         $files =& $file_handler->getObjects($criteria, false, 'item_id', true, $join);
         if (false === $files) {
             return false;
         }
         $item_ids = array();
         foreach ($files as $file) {
             $item_ids[] = $file->get('item_id');
         }
         return $item_ids;
     } else {
         return false;
     }
 }
示例#8
0
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;
}
 /**
  * get creator objects of this item
  * @return XNPConferenceOrmCreator[] 
  */
 function getCreators()
 {
     $handler =& xoonips_getormhandler('xnpmodel', 'creator');
     $criteria = new Criteria('model_id', $this->get('model_id'));
     $criteria->setSort('creator_order');
     $result =& $handler->getObjects($criteria);
     if ($result) {
         return $result;
     }
     return array();
 }
示例#10
0
 /**
  * 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;
 }
 /**
  * get author objects of this item
  * @return XNPPaperOrmAuthor[] 
  */
 function getAuthors()
 {
     $handler =& xoonips_getormhandler('xnppaper', 'author');
     $criteria = new Criteria('paper_id', $this->get('paper_id'));
     $criteria->setSort('author_order');
     $result =& $handler->getObjects($criteria);
     if ($result) {
         return $result;
     }
     return array();
 }
示例#12
0
 /**
  * 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;
 }
 /**
  * get experimenter objects of this item
  * @return XNPDataOrmExperimenter[] 
  */
 function getExperimenters()
 {
     $handler =& xoonips_getormhandler('xnpdata', 'experimenter');
     $criteria = new Criteria('data_id', $this->get('data_id'));
     $criteria->setSort('experimenter_order');
     $result =& $handler->getObjects($criteria);
     if ($result) {
         return $result;
     }
     return array();
 }
示例#14
0
 /**
  * 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;
 }
 /**
  * get developer objects of this item
  * @return XnpstimulusOrmDeveloper[] 
  */
 function getDevelopers()
 {
     $handler =& xoonips_getormhandler('xnpstimulus', 'developer');
     $criteria = new Criteria('stimulus_id', $this->get('stimulus_id'));
     $criteria->setSort('developer_order');
     $result =& $handler->getObjects($criteria);
     if ($result) {
         return $result;
     }
     return array();
 }
示例#16
0
 function &getByPermission($permission = "access", $tags = null, $asObject = true)
 {
     $categories = array();
     if (!($valid_ids = $this->getIdsByPermission($permission))) {
         return $categories;
     }
     $criteria = new Criteria("cat_id", "(" . implode(", ", $valid_ids) . ")", "IN");
     $criteria->setSort("cat_order");
     $categories = $this->getAll($criteria, $tags, $asObject);
     return $categories;
 }
示例#17
0
 /**
  * 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;
 }
示例#18
0
 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;
 }
 function &getRepositories($fmt)
 {
     $criteria = new Criteria('deleted', '1', '!=');
     $criteria->setSort('sort');
     $objs =& $this->getObjects($criteria, true, 'repository_id,URL,enabled');
     $urls = array();
     foreach ($objs as $id => $obj) {
         $url = $obj->getVar('URL', $fmt);
         $enabled = $obj->getVar('enabled', $fmt);
         $urls[$id] = array('URL' => $url, 'enabled' => $enabled);
     }
     return $urls;
 }
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;
}
示例#21
0
    function &getAllCats($permission = false, $idAsKey = true, $tags = null)
    {
	    $perm_string = (empty($permission))?'all':'access';
        $_cachedCats[$perm_string]=array();
        $criteria = new Criteria("1", 1);
        $criteria->setSort("cat_order");
        $categories =& $this->getAll($criteria, $tags, $idAsKey);
        foreach(array_keys($categories) as $key){
            if ($permission && !$this->getPermission($categories[$key])) continue;
            if($idAsKey){
            	$_cachedCats[$perm_string][$key] = $categories[$key];
            }else{
            	$_cachedCats[$perm_string][] = $categories[$key];
        	}
        }
        return $_cachedCats[$perm_string];
    }
function &positions_get_userlist()
{
    global $xoopsDB;
    $xusers_handler =& xoonips_getormhandler('xoonips', 'users');
    $tables['users'] = $xoopsDB->prefix('users');
    $tables['xusers'] = $xoopsDB->prefix('xoonips_users');
    $tables['positions'] = $xoopsDB->prefix('xoonips_positions');
    $join_criteria = new XooNIpsJoinCriteria('users', 'uid', 'uid');
    $join_criteria->cascade(new XooNIpsJoinCriteria('xoonips_positions', 'posi', 'posi_id'), 'xoonips_users');
    $criteria = new Criteria($tables['xusers'] . '.posi', '0', '>');
    $criteria->setSort(array($tables['positions'] . '.posi_order', $tables['xusers'] . '.user_order'));
    $fields = array();
    $fields[] = $tables['xusers'] . '.uid';
    $fields[] = $tables['xusers'] . '.user_order';
    $fields[] = $tables['users'] . '.name';
    $fields[] = $tables['users'] . '.uname';
    $fields[] = $tables['positions'] . '.posi_title';
    $xusers_objs =& $xusers_handler->getObjects($criteria, false, implode(',', $fields), false, $join_criteria);
    return $xusers_objs;
}
 /**
  * metadata field array from search cache id
  * @access private
  * @param string $identifier
  * @return array of metadata
  */
 function getMetadataArray($identifier)
 {
     $metadata_handler =& xoonips_getormhandler('xoonips', 'oaipmh_metadata');
     $metadata =& $metadata_handler->getObjects(new Criteria('identifier', $identifier));
     if (!$metadata) {
         return array();
     }
     $metadata_field_handler =& xoonips_getormhandler('xoonips', 'oaipmh_metadata_field');
     $criteria = new Criteria('metadata_id', $metadata[0]->get('metadata_id'));
     $criteria->setSort('ordernum');
     $fields =& $metadata_field_handler->getObjects($criteria);
     if (!$fields) {
         return array();
     }
     $result = array();
     foreach ($fields as $field) {
         $result[] = $field->getVarArray('s');
     }
     return $result;
 }
 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);
 }
示例#25
0
     }
     $pm =& $pm_handler->get(intval($_POST['msg_id']));
     if (!is_object($pm) || $pm->getVar('to_userid') != $xoopsUser->getVar('uid') || !$pm_handler->delete($pm)) {
         exit;
     } else {
         redirect_header("viewpmsg.php", 1, _PM_DELETED);
         exit;
     }
 }
 $start = !empty($_GET['start']) ? intval($_GET['start']) : 0;
 $total_messages = !empty($_GET['total_messages']) ? intval($_GET['total_messages']) : 0;
 include XOOPS_ROOT_PATH . '/header.php';
 $criteria = new Criteria('to_userid', $xoopsUser->getVar('uid'));
 $criteria->setLimit(1);
 $criteria->setStart($start);
 $criteria->setSort('msg_time');
 $pm_arr =& $pm_handler->getObjects($criteria);
 echo "<div><h4>" . _PM_PRIVATEMESSAGE . "</h4></div><br /><a href='userinfo.php?uid=" . $xoopsUser->getVar("uid") . "'>" . _PM_PROFILE . "</a>&nbsp;<span style='font-weight:bold;'>&raquo;&raquo;</span>&nbsp;<a href='viewpmsg.php'>" . _PM_INBOX . "</a>&nbsp;<span style='font-weight:bold;'>&raquo;&raquo;</span>&nbsp;\n";
 if (empty($pm_arr)) {
     echo '<br /><br />' . _PM_YOUDONTHAVE;
 } else {
     if (!$pm_handler->setRead($pm_arr[0])) {
         //echo "failed";
     }
     echo $pm_arr[0]->getVar("subject") . "<br /><form action='readpmsg.php' method='post' name='delete" . $pm_arr[0]->getVar("msg_id") . "'><table border='0' cellpadding='4' cellspacing='1' class='outer' width='100%'><tr><th colspan='2'>" . _PM_FROM . "</th></tr><tr class='even'>\n";
     $poster = new XoopsUser($pm_arr[0]->getVar("from_userid"));
     if (!$poster->isActive()) {
         $poster = false;
     }
     echo "<td valign='top'>";
     if ($poster != false) {
 $selectOrder->addOptionArray($linkCategoryHandler->getSortOptionArray());
 $selectOrderControl = $selectOrder->render();
 $ticketHiddenContorl = $xoopsWPTicket->getTicketHtml(__LINE__);
 $helpLink = gethelp_link($this_file, 'list_o_links');
 $selectSetLinkCat = new XoopsFormSelect("", "category");
 $selectSetLinkCat->addOptionArray($linkCategoryHandler->getOptionArray());
 $selectSetLinkCatControl = $selectSetLinkCat->render();
 $selectSetUser = new XoopsFormSelect("", "newowner");
 $selectSetUser->addOptionArray($userHandler->getOptionArray());
 $selectSetUserControl = $selectSetUser->render();
 if (isset($cat_id) && $cat_id != 'All') {
     $criteria = new Criteria('link_category', $cat_id);
 } else {
     $criteria = new Criteria(1, 1);
 }
 $criteria->setSort($order_by);
 $links = $linkHandler->getObjects($criteria);
 $style = "";
 if ($links) {
     $link_rows = array();
     foreach ($links as $link) {
         $style = 'class="odd"' == $style ? 'class="even"' : 'class="odd"';
         $row = $link->getVarArray();
         $row['style'] = $style;
         $short_url = str_replace('http://', '', stripslashes($row['link_url']));
         $short_url = str_replace('www.', '', $short_url);
         if ('/' == substr($short_url, -1)) {
             $short_url = substr($short_url, 0, -1);
         }
         if (strlen($short_url) > 35) {
             $short_url = substr($short_url, 0, 32) . '...';
         if (!$linkCategoryHandler->insert($linkCategory)) {
             redirect_header(wp_siteurl() . '/wp-admin/' . $this_file, 3, $linkCategoryHandler->getErrors());
         }
     }
     header('Location: ' . $this_file);
     break;
 default:
     $standalone = 0;
     $title = 'Link Categories';
     include_once "./admin-header.php";
     if ($user_level < get_settings('links_minadminlevel')) {
         redirect_header(wp_siteurl() . '/wp-admin/', 5, _LANG_WLC_RIGHT_PROM);
         exit;
     }
     $criteria = new Criteria(1, 1);
     $criteria->setSort('cat_id');
     $linkCats = $linkCategoryHandler->getObjects($criteria);
     $linkCat_rows = array();
     $style = "";
     foreach ($linkCats as $linkCat) {
         $style = 'class="odd"' == $style ? 'class="even"' : 'class="odd"';
         $row = $linkCat->getVarArray();
         $row['style'] = $style;
         if ($row['list_limit'] == -1) {
             $row['list_limit'] = 'none';
         }
         $linkCat_rows[] = $row;
     }
     $form_title = _LANG_WLC_ADD_TITLE;
     $form_id = "addcat";
     $cat_name = "";
示例#28
0
     }
     // 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;
示例#29
0
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;
}
示例#30
0
 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&amp;limit={$limit}&amp;order={$order}&amp;sort={$sort}&amp;mime_search=1&amp;search_by={$searchField}&amp;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>
     &nbsp;&nbsp;&nbsp;
     ' . _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>
     &nbsp;&nbsp;&nbsp;
     ' . _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&amp;id=' . $mime->getVar('mime_id') . '&amp;mime_admin=' . $mime->getVar('mime_admin') . '&amp;limit=' . $limit . '&amp;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&amp;id=' . $mime->getVar('mime_id') . '&amp;mime_user='******'mime_user') . '&amp;limit=' . $limit . '&amp;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&amp;id=' . $mime->getVar('mime_id') . '&amp;limit=' . $limit . '&amp;start=' . $start . "'>" . $imagearray['editimg'] . "</a>\n                <a href='" . PUBLISHER_ADMIN_URL . '/mimetypes.php?op=delete&amp;id=' . $mime->getVar('mime_id') . '&amp;limit=' . $limit . '&amp;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();
 }