Exemplo n.º 1
0
function about_block_page_edit($options)
{
    @(include dirname(dirname(__FILE__)) . "/xoops_version.php");
    $page_handler =& xoops_getmodulehandler('page', 'about');
    $criteria = new CriteriaCompo();
    $criteria->add(new Criteria('page_status', 1), 'AND');
    $criteria->add(new Criteria('page_type', 1));
    $criteria->setSort('page_order');
    $criteria->setOrder('ASC');
    $fields = array("page_id", "page_title", "page_image");
    $pages = $page_handler->getAll($criteria, $fields, false);
    $page_title = '';
    foreach ($pages as $k => $v) {
        $page_title = '<a href="' . XOOPS_URL . '/modules/' . $modversion['dirname'] . '/index.php?page_id=' . $k . '" target="_blank">' . $v['page_title'] . '</a>';
        $options_page[$k] = empty($v['page_image']) ? $page_title : $page_title . '<img src="' . XOOPS_URL . '/modules/' . $modversion['dirname'] . '/images/picture.png' . '" />';
    }
    include_once dirname(dirname(__FILE__)) . '/include/xoopsformloader.php';
    $form = new XoopsBlockForm();
    $page_select = new XoopsFormRadio(_MI_ABOUT_BLOCKPAGE, 'options[0]', $options[0], '<br />');
    $page_select->addOptionArray($options_page);
    $form->addElement($page_select);
    $form->addElement(new XoopsFormText(_MI_ABOUT_TEXT_LENGTH, 'options[1]', 5, 5, $options[1]));
    $form->addElement(new XoopsFormText(_MI_ABOUT_VIEW_MORELINKTEXT, 'options[2]', 30, 50, $options[2]));
    $form->addElement(new XoopsFormRadioYN(_MI_ABOUT_DOTITLEIMAGE, 'options[3]', $options[3]));
    return $form->render();
}
Exemplo n.º 2
0
 /**
  * Constructor
  *
  * @param string $caption
  * @param string $name
  * @param mixed $value Pre-selected value (or array of them).
  *                                                 For an item with massive members, such as "Registered Users", "$value" should be used to store selected temporary users only instead of all members of that item
  * @param bool $include_anon Include user "anonymous"?
  * @param int $size Number or rows. "1" makes a drop-down-list.
  * @param bool $multiple Allow multiple selections?
  */
 function XoopsFormSelectUser($caption, $name, $include_anon = false, $value = null, $size = 1, $multiple = false)
 {
     $limit = 200;
     $select_element = new XoopsFormSelect('', $name, $value, $size, $multiple);
     if ($include_anon) {
         $select_element->addOption(0, $GLOBALS['xoopsConfig']['anonymous']);
     }
     $member_handler =& xoops_gethandler('member');
     $user_count = $member_handler->getUserCount();
     $value = is_array($value) ? $value : (empty($value) ? array() : array($value));
     if ($user_count > $limit && count($value) > 0) {
         $criteria = new CriteriaCompo(new Criteria('uid', '(' . implode(',', $value) . ')', 'IN'));
     } else {
         $criteria = new CriteriaCompo();
         $criteria->setLimit($limit);
     }
     $criteria->setSort('uname');
     $criteria->setOrder('ASC');
     $users = $member_handler->getUserList($criteria);
     $select_element->addOptionArray($users);
     if ($user_count <= $limit) {
         $this->XoopsFormElementTray($caption, "", $name);
         $this->addElement($select_element);
         return;
     }
     xoops_loadLanguage('findusers');
     $js_addusers = "<script type='text/javascript'>\r\n            function addusers(opts){\r\n                var num = opts.substring(0, opts.indexOf(':'));\r\n                opts = opts.substring(opts.indexOf(':')+1, opts.length);\r\n                var sel = xoopsGetElementById('" . $name . "');\r\n                var arr = new Array(num);\r\n                for (var n=0; n < num; n++) {\r\n                    var nm = opts.substring(0, opts.indexOf(':'));\r\n                    opts = opts.substring(opts.indexOf(':')+1, opts.length);\r\n                    var val = opts.substring(0, opts.indexOf(':'));\r\n                    opts = opts.substring(opts.indexOf(':')+1, opts.length);\r\n                    var txt = opts.substring(0, nm - val.length);\r\n                    opts = opts.substring(nm - val.length, opts.length);\r\n                    var added = false;\r\n                    for (var k = 0; k < sel.options.length; k++) {\r\n                        if(sel.options[k].value == val){\r\n                            added = true;\r\n                            break;\r\n                        }\r\n                    }\r\n                    if (added == false) {\r\n                        sel.options[k] = new Option(txt, val);\r\n                        sel.options[k].selected = true;\r\n                    }\r\n                }\r\n                return true;\r\n            }\r\n            </script>";
     $token = $GLOBALS['xoopsSecurity']->createToken();
     $action_tray = new XoopsFormElementTray("", " | ");
     $action_tray->addElement(new XoopsFormLabel('', '<a href="#" onclick="var sel = xoopsGetElementById(\'' . $name . '\');for (var i = sel.options.length-1; i >= 0; i--) {if (!sel.options[i].selected) {sel.options[i] = null;}}; return false;">' . _MA_USER_REMOVE . "</a>"));
     $action_tray->addElement(new XoopsFormLabel('', '<a href="#" onclick="openWithSelfMain(\'' . XOOPS_URL . '/include/findusers.php?target=' . $name . '&amp;multiple=' . $multiple . '&amp;token=' . $token . '\', \'userselect\', 800, 600, null); return false;" >' . _MA_USER_MORE . "</a>" . $js_addusers));
     $this->XoopsFormElementTray($caption, '<br /><br />', $name);
     $this->addElement($select_element);
     $this->addElement($action_tray);
 }
Exemplo n.º 3
0
function ifocusComponentsShow($options)
{
    include_once XOOPS_ROOT_PATH . "/modules/spotlight/components/ifocus/config.php";
    $sp_handler =& xoops_getmodulehandler('spotlight', 'spotlight');
    $page_handler =& xoops_getmodulehandler('page', 'spotlight');
    // spotlight object
    $sp_obj = $sp_handler->get($options[0]);
    if (!is_object($sp_obj) || empty($options[0])) {
        trigger_error("spotlight is not object ", E_USER_WARNING);
    } else {
        //spotlight name
        $block['sp_name'] = $sp_obj->getVar('sp_name');
        // page list
        $criteria = new CriteriaCompo();
        $criteria->add(new Criteria('sp_id', $options[0]));
        $criteria->setLimit($config['limit']);
        $criteria->setSort($config['sort']);
        $criteria->setOrder('ASC');
        $pages = $page_handler->getAll($criteria, array('page_id', 'page_title', 'page_link', 'page_image', 'page_desc'), false);
        foreach ($pages as $k => $v) {
            $block['news'][$k] = $v;
            $block['news'][$k]['images'] = XOOPS_UPLOAD_URL . '/spotlight/image_' . $v['page_image'];
            $block['news'][$k]['thumbs'] = XOOPS_UPLOAD_URL . '/spotlight/thumb_' . $v['page_image'];
        }
        // component name
        $block['component'] = $sp_obj->getVar('component_name');
        return $block;
    }
}
Exemplo n.º 4
0
 /**
  * Constructor
  * 
  * @param	string	$caption	
  * @param	string	$name
  * @param	mixed	$value	    	Pre-selected value (or array of them).
  *									For an item with massive members, such as "Registered Users", "$value" should be used to store selected temporary users only instead of all members of that item
  * @param	bool	$include_anon	Include user "anonymous"?
  * @param	int		$size	        Number or rows. "1" makes a drop-down-list.
  * @param	bool    $multiple       Allow multiple selections?
  */
 function XoopsFormSelectUser($caption, $name, $value = array(), $include_anon = false, $size = 1, $multiple = false)
 {
     $this->XoopsFormElementTray($caption, "<br /><br />", $name);
     $select_form = new XoopsFormSelect("", $name, $value, $size, $multiple);
     if ($include_anon) {
         $select_form->addOption(0, $GLOBALS["xoopsConfig"]['anonymous']);
     }
     $member_handler =& xoops_gethandler('member');
     $criteria = new CriteriaCompo();
     if (!is_array($value)) {
         $value = array($value);
     }
     if (is_array($value) && count($value) > 0) {
         $id_in = "(" . implode(",", $value) . ")";
         $criteria->add(new Criteria("uid", $id_in, "IN"));
         $criteria->setSort('name');
         $criteria->setOrder('ASC');
         $users = $member_handler->getUserList($criteria);
         $select_form->addOptionArray($member_handler->getUserList($criteria));
     }
     $action_tray = new XoopsFormElementTray("", " | ");
     $action_tray->addElement(new XoopsFormLabel('', "<a href='###' onclick='return openWithSelfMain(\"" . XOOPS_URL . "/modules/system/include/userselect.php?action=1&amp;target=" . $name . "&amp;multiple=" . $multiple . "\", \"userselect\", 800, 500, null);' >" . _LIST . "</a>"));
     $action_tray->addElement(new XoopsFormLabel('', "<a href='###' onclick='return openWithSelfMain(\"" . XOOPS_URL . "/modules/system/include/userselect.php?action=0&amp;target=" . $name . "&amp;multiple=" . $multiple . "\", \"userselect\", 800, 500, null);' >" . _SEARCH . "</a>"));
     $action_tray->addElement(new XoopsFormLabel('', "<a href='###' onclick='var sel = xoopsGetElementById(\"" . $name . "\");for (var i = sel.options.length-1; i >= 0; i--) {if (sel.options[i].selected) {sel.options[i] = null;}}'>" . _REMOVE . "</a>" . "<script type=\"text/javascript\">\n\t\t    function addusers(opts){\n\t\t\t    var num = opts.substring(0, opts.indexOf(\":\"));\n\t\t\t    opts = opts.substring(opts.indexOf(\":\")+1, opts.length);\n        \t\tvar sel = xoopsGetElementById(\"" . $name . "\");\n\t\t\t    var arr = new Array(num);\n\t\t\t    for(var n=0; n<num; n++){\n\t\t\t    \tvar nm = opts.substring(0, opts.indexOf(\":\"));\n\t\t\t    \topts = opts.substring(opts.indexOf(\":\")+1, opts.length);\n\t\t\t    \tvar val = opts.substring(0, opts.indexOf(\":\"));\n\t\t\t    \topts = opts.substring(opts.indexOf(\":\")+1, opts.length);\n\t\t\t    \tvar txt = opts.substring(0, nm - val.length);\n\t\t\t    \topts = opts.substring(nm - val.length, opts.length);\n\t\t\t\t\tvar added = false;\n\t\t\t\t\tfor (var k = 0; k < sel.options.length; k++) {\n\t\t\t\t\t\tif(sel.options[k].value == val){\n\t\t\t\t\t\t\tadded = true;\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tif(added==false){\n\t\t\t\t\t\tappendSelectOption(\"" . $name . "\",txt, val);\n\t        \t\t}\n\t\t\t    }\n\t\t\t\treturn true;\n\t\t    }\n\t\t\t</script>"));
     $this->addElement($select_form);
     $this->addElement($action_tray);
 }
Exemplo n.º 5
0
 /**
  * Constructor
  *
  * @param    string    $caption
  * @param    string    $name
  * @param    mixed    $value            Pre-selected value (or array of them).
  *                                    For an item with massive members, such as "Registered Users", "$value" should be used to store selected temporary users only instead of all members of that item
  * @param    bool    $include_anon    Include user "anonymous"?
  * @param    int        $size            Number or rows. "1" makes a drop-down-list.
  * @param    bool    $multiple       Allow multiple selections?
  */
 function __construct($caption, $name, $include_anon = false, $value = null, $size = 1, $multiple = false)
 {
     $limit = 200;
     $select_element = new Xmf_Form_Element_Select("", $name, $value, $size, $multiple);
     if ($include_anon) {
         $select_element->addOption(0, $GLOBALS["xoopsConfig"]['anonymous']);
     }
     $member_handler =& xoops_gethandler('member');
     $user_count = $member_handler->getUserCount();
     $value = is_array($value) ? $value : (empty($value) ? array() : array($value));
     if ($user_count > $limit && count($value) > 0) {
         $criteria = new CriteriaCompo(new Criteria("uid", "(" . implode(",", $value) . ")", "IN"));
     } else {
         $criteria = new CriteriaCompo();
         $criteria->setLimit($limit);
     }
     $criteria->setSort('uname');
     $criteria->setOrder('ASC');
     $users = $member_handler->getUserList($criteria);
     $select_element->addOptionArray($users);
     if ($user_count <= $limit) {
         parent::__construct($caption, "", $name);
         $this->addElement($select_element);
         return;
     }
     xoops_loadLanguage("findusers");
     $js_addusers = "<script type=\"text/javascript\">\r\n            function addusers(opts){\r\n                var num = opts.substring(0, opts.indexOf(\":\"));\r\n                opts = opts.substring(opts.indexOf(\":\")+1, opts.length);\r\n                var sel = xoopsGetElementById(\"" . $name . ($multiple ? "[]" : "") . "\");\r\n                var arr = new Array(num);\r\n                for (var n=0; n < num; n++) {\r\n                    var nm = opts.substring(0, opts.indexOf(\":\"));\r\n                    opts = opts.substring(opts.indexOf(\":\")+1, opts.length);\r\n                    var val = opts.substring(0, opts.indexOf(\":\"));\r\n                    opts = opts.substring(opts.indexOf(\":\")+1, opts.length);\r\n                    var txt = opts.substring(0, nm - val.length);\r\n                    opts = opts.substring(nm - val.length, opts.length);\r\n                    var added = false;\r\n                    for (var k = 0; k < sel.options.length; k++) {\r\n                        if(sel.options[k].value == val){\r\n                            added = true;\r\n                            break;\r\n                        }\r\n                    }\r\n                    if (added == false) {\r\n                        sel.options[k] = new Option(txt, val);\r\n                        sel.options[k].selected = true;\r\n                    }\r\n                }\r\n                return true;\r\n            }\r\n            </script>";
     $token = $GLOBALS['xoopsSecurity']->createToken();
     $action_tray = new Xmf_Form_Element_Tray("", " | ");
     $action_tray->addElement(new Xmf_Form_Element_Label('', "<a href='#' onclick='var sel = xoopsGetElementById(\"" . $name . ($multiple ? "[]" : "") . "\");for (var i = sel.options.length-1; i >= 0; i--) {if (!sel.options[i].selected) {sel.options[i] = null;}}; return false;'>" . _MA_USER_REMOVE . "</a>"));
     $action_tray->addElement(new Xmf_Form_Element_Label('', "<a href='#' onclick='openWithSelfMain(\"" . XOOPS_URL . "/include/findusers.php?target={$name}&amp;multiple={$multiple}&amp;token={$token}\", \"userselect\", 800, 600, null); return false;' >" . _MA_USER_MORE . "</a>" . $js_addusers));
     parent::__construct($caption, "<br /><br />", $name);
     $this->addElement($select_element);
     $this->addElement($action_tray);
 }
Exemplo n.º 6
0
function showcaseComponentsShow($options)
{
    include XOOPS_ROOT_PATH . "/modules/spotlight/components/showcase/config.php";
    $sp_handler =& xoops_getmodulehandler('spotlight', 'spotlight');
    $page_handler =& xoops_getmodulehandler('page', 'spotlight');
    // spotlight object
    $sp_obj = $sp_handler->get($options[0]);
    if (!is_object($sp_obj) || empty($options[0])) {
        trigger_error("spotlight is not object ", E_USER_WARNING);
    } else {
        //spotlight name
        $block['sp_name'] = $sp_obj->getVar('sp_name');
        // page list
        $criteria = new CriteriaCompo();
        $criteria->add(new Criteria('sp_id', $options[0]));
        $criteria->setLimit($config['limit']);
        $criteria->setSort($config['sort']);
        $criteria->setOrder('ASC');
        $pages = $page_handler->getAll($criteria, array('page_id', 'page_title', 'page_link', 'page_image', 'page_desc', 'published'), false);
        $myts = MyTextSanitizer::getInstance();
        foreach ($pages as $k => $v) {
            $block['news'][$k] = $v;
            $block['news'][$k]['images'] = XOOPS_UPLOAD_URL . '/spotlight/image_' . $v['page_image'];
            $block['news'][$k]['thumbs'] = XOOPS_UPLOAD_URL . '/spotlight/thumb_' . $v['page_image'];
            $page_desc = strip_tags($myts->undoHtmlSpecialChars(strip_tags($v['page_desc'])));
            $block['news'][$k]['page_desc'] = xoops_substr($page_desc, '', $config['page_desc_substr']);
            $block['news'][$k]['page_title'] = xoops_substr($v['page_title'], '', $config['page_title_substr']);
            $block['news'][$k]['published'] = formatTimestamp($v['published'], $config['timeformat']);
        }
        // component name
        $block['component'] = $sp_obj->getVar('component_name');
        return $block;
    }
}
Exemplo n.º 7
0
 public function getCategoryList($uid = 0)
 {
     $criteria = new CriteriaCompo();
     if (!empty($uid)) {
         $criteria->add(new Criteria("uid", $uid));
     }
     $criteria->setOrder("ASC");
     $criteria->setSort("cat_id");
     $categories = $this->getAll($criteria);
     $catarr = array();
     if ($this->getCount($criteria)) {
         unset($criteria);
         $topic_handler = xoops_getmodulehandler("topics", "press");
         $criteria = new CriteriaCompo(new Criteria("cat_id", "(" . implode(",", array_keys($categories)) . ")", "in"));
         if (!empty($uid)) {
             $criteria->add(new Criteria("uid", $uid));
         }
         $criteria->setGroupby("cat_id");
         $counts = $topic_handler->getCounts($criteria);
         foreach ($categories as $key => $obj) {
             $catarr[$key]["cat_name"] = $obj->getVar("cat_name");
             $catarr[$key]["cat_id"] = $key;
             if (!empty($uid)) {
                 $catarr[$key]["uid"] = $uid;
             }
             $catarr[$key]["cat_topics"] = isset($counts[$key]) ? $counts[$key] : 0;
         }
         return $catarr;
     }
 }
Exemplo n.º 8
0
function publisher_date_to_date_show($options)
{
    $myts = MyTextSanitizer::getInstance();
    $publisher = PublisherPublisher::getInstance();
    $block = array();
    $criteria = new CriteriaCompo();
    $criteria->add(new Criteria('datesub', strtotime($options[0]), '>'));
    $criteria->add(new Criteria('datesub', strtotime($options[1]), '<'));
    $criteria->setSort('datesub');
    $criteria->setOrder('DESC');
    // creating the ITEM objects that belong to the selected category
    $itemsObj = $publisher->getHandler('item')->getObjects($criteria);
    $totalItems = count($itemsObj);
    if ($itemsObj) {
        for ($i = 0; $i < $totalItems; $i++) {
            $newItems['itemid'] = $itemsObj[$i]->itemid();
            $newItems['title'] = $itemsObj[$i]->title();
            $newItems['categoryname'] = $itemsObj[$i]->getCategoryName();
            $newItems['categoryid'] = $itemsObj[$i]->categoryid();
            $newItems['date'] = $itemsObj[$i]->datesub();
            $newItems['poster'] = $itemsObj[$i]->linkedPosterName();
            $newItems['itemlink'] = $itemsObj[$i]->getItemLink(false, isset($options[3]) ? $options[3] : 65);
            $newItems['categorylink'] = $itemsObj[$i]->getCategoryLink();
            $block['items'][] = $newItems;
        }
        $block['lang_title'] = _MB_PUBLISHER_ITEMS;
        $block['lang_category'] = _MB_PUBLISHER_CATEGORY;
        $block['lang_poster'] = _MB_PUBLISHER_POSTEDBY;
        $block['lang_date'] = _MB_PUBLISHER_DATE;
        $modulename = $myts->displayTarea($publisher->getModule()->getVar('name'));
        $block['lang_visitItem'] = _MB_PUBLISHER_VISITITEM . " " . $modulename;
        $block['lang_articles_from_to'] = sprintf(_MB_PUBLISHER_ARTICLES_FROM_TO, $options[0], $options[1]);
    }
    return $block;
}
Exemplo n.º 9
0
function b_user_topusers_show($options)
{
    $block = array();
    $criteria = new CriteriaCompo(new Criteria('level', 0, '>'));
    $limit = (!empty($options[0])) ? $options[0] : 10;
    $size = count($options);
    for ( $i = 2; $i < $size; $i++) {
        $criteria->add(new Criteria('rank', $options[$i], '<>'));
    }
    $criteria->setOrder('DESC');
    $criteria->setSort('posts');
    $criteria->setLimit($limit);
    $member_handler =& xoops_gethandler('member');
    $topposters =& $member_handler->getUsers($criteria);
    $count = count($topposters);
    for ($i = 0; $i < $count; $i++) {
        $block['users'][$i]['rank'] = $i+1;
        if ( $options[1] == 1 ) {
            $block['users'][$i]['avatar'] = $topposters[$i]->getVar('user_avatar') != 'blank.gif' ? XOOPS_UPLOAD_URL.'/'.$topposters[$i]->getVar('user_avatar') : '';
        } else {
            $block['users'][$i]['avatar'] = '';
        }
        $block['users'][$i]['id'] = $topposters[$i]->getVar('uid');
        $block['users'][$i]['name'] = $topposters[$i]->getVar('uname');
        $block['users'][$i]['posts'] = $topposters[$i]->getVar('posts');
    }
    return $block;
}
Exemplo n.º 10
0
function links_block_edit($options)
{
    include_once XOOPS_ROOT_PATH . "/modules/links/include/xoopsformloader.php";
    $form = new XoopsBlockForm("", "", "");
    $categories = new XoopsFormSelect(_MB_LINKS_SHOWCAT, 'options[0]', $options[0]);
    $categories->addOption(0, _MB_LINKS_ALL);
    $cat_handler = xoops_getmodulehandler('category', 'links');
    $criteria = new CriteriaCompo();
    $criteria->setSort('cat_order');
    $criteria->setOrder('ASC');
    $category = $cat_handler->getList($criteria);
    foreach ($cat_handler->getList($criteria) as $k => $v) {
        $categories->addOption($k, $v);
    }
    $form->addElement($categories, true);
    $sort = new XoopsFormSelect(_MB_LINKS_SORTWAY, 'options[1]', $options[1]);
    $sort->addOption('published', _MB_LINKS_PUBLISHTIME);
    $sort->addOption('datetime', _MB_LINKS_UPDATETIME);
    $sort->addOption('link_order', _MB_LINKS_DEFAULT);
    $form->addElement($sort, true);
    $form->addElement(new XoopsFormText(_MB_LINKS_SHOWHOWLIK, "options[2]", 5, 2, $options[2]), true);
    $form->addElement(new XoopsFormText(_MB_LINKS_LIKTITLEMAX, "options[3]", 5, 2, $options[3]), true);
    $form->addElement(new XoopsFormRadioYN(_MB_LINKS_SHOWCATTITLE, 'options[4]', $options[4]), true);
    $display = new XoopsFormSelect(_MB_LINKS_BYSHOW, 'options[5]', $options[5]);
    $display->addOption('1', _MB_LINKS_LOGOHOR);
    $display->addOption('2', _MB_LINKS_LOGOVER);
    $display->addOption('3', _MB_LINKS_TITLEHOR);
    $display->addOption('4', _MB_LINKS_TITLEVER);
    $form->addElement($display, true);
    return $form->render();
}
Exemplo n.º 11
0
 function alumniCategoryDisplayChildren($cid = 0, $categoryArray, $prefix = '', $order = '', &$class)
 {
     $xoops = Xoops::getInstance();
     $moduleDirName = basename(dirname(__DIR__));
     $prefix = $prefix . '<img src=\'' . XOOPS_URL . "/modules/{$moduleDirName}/images/arrow.gif'>";
     foreach (array_keys($categoryArray) as $i) {
         $cid = $categoryArray[$i]->getVar('cid');
         $pid = $categoryArray[$i]->getVar('pid');
         $title = $categoryArray[$i]->getVar('title');
         $img = $categoryArray[$i]->getVar('img');
         $order = $categoryArray[$i]->getVar('ordre');
         echo '<tr class="' . $class . '">';
         echo '<td align="left">' . $prefix . '&nbsp;' . $categoryArray[$i]->getVar('title') . '</td>';
         echo '<td align="center"><img src="' . XOOPS_URL . "/modules/{$moduleDirName}/images/cat/" . $categoryArray[$i]->getVar('img') . '" height="16px" title="img" alt="img"></td>';
         echo '<td align="center">' . $categoryArray[$i]->getVar('ordre') . '</td>';
         echo "<td align='center' width='10%'>\n\t\t\t\t\t\t<a href='category.php?op=edit_category&cid=" . $categoryArray[$i]->getVar('cid') . "'><img src='../images/edit.gif' alt='" . XoopsLocale::A_EDIT . "' title='" . XoopsLocale::A_EDIT . "'></a>\n\t\t\t\t\t\t<a href='category.php?op=delete_category&cid=" . $categoryArray[$i]->getVar('cid') . "'><img src='../images/dele.gif' alt='" . XoopsLocale::A_DELETE . "' title='" . XoopsLocale::A_DELETE . "'></a></td></tr>";
         $class = $class == "even" ? "odd" : "even";
         $categoriesHandler = $xoops->getModuleHandler('category', 'alumni');
         $criteria2 = new CriteriaCompo();
         $criteria2->add(new Criteria('pid', $categoryArray[$i]->getVar('cid')));
         $criteria2->setSort('title');
         $criteria2->setOrder('ASC');
         $cat_pid = $categoriesHandler->getAll($criteria2);
         $num_pid = $categoriesHandler->getCount();
         if ($num_pid != 0) {
             alumniCategoryDisplayChildren($cid, $cat_pid, $prefix, $order, $class);
         }
     }
 }
Exemplo n.º 12
0
/**
 * @param $options
 * @return array
 */
function alumni_show($options)
{
    $block = array();
    $myts = MyTextSanitizer::getInstance();
    $xoops = Xoops::getInstance();
    $helper = $xoops->getModuleHelper('alumni');
    $module_id = $helper->getModule()->getVar('mid');
    $listingHandler = $helper->getHandler('listing');
    $groups = $xoops->getUserGroups();
    $alumni_ids = $xoops->getHandlerGroupPermission()->getItemIds('alumni_view', $groups, $module_id);
    $all_ids = implode(', ', $alumni_ids);
    $criteria = new CriteriaCompo();
    $criteria->add(new Criteria('valid', 1, '='));
    $criteria->add(new Criteria('cid', '(' . $all_ids . ')', 'IN'));
    $criteria->setLimit($options[1]);
    $criteria->setSort('date');
    $criteria->setOrder('DESC');
    $block_listings = $listingHandler->getall($criteria);
    foreach (array_keys($block_listings) as $i) {
        $name = $block_listings[$i]->getVar('name');
        $mname = $block_listings[$i]->getVar('mname');
        $lname = $block_listings[$i]->getVar('lname');
        $school = $block_listings[$i]->getVar('school');
        $year = $block_listings[$i]->getVar('year');
        $view = $block_listings[$i]->getVar('view');
        $a_item = array();
        $a_item['school'] = $school;
        $a_item['link'] = '<a href="' . XOOPS_URL . "/modules/alumni/listing.php?lid=" . addslashes($block_listings[$i]->getVar('lid')) . "\"><b>{$year}&nbsp;-&nbsp;{$name} {$mname} {$lname}</b><br /></a>";
        $block['items'][] = $a_item;
    }
    $block['lang_title'] = AlumniLocale::BLOCKS_ITEM;
    $block['lang_date'] = AlumniLocale::BLOCKS_DATE;
    $block['link'] = "<a href=\"" . XOOPS_URL . "/modules/alumni/index.php\"><b>" . AlumniLocale::BLOCKS_ALL_LISTINGS . "</b></a></div>";
    return $block;
}
Exemplo n.º 13
0
/**
 * xoopsfaq_search()
 *
 * @param mixed $queryarray
 * @param mixed $andor
 * @param mixed $limit
 * @param mixed $offset
 * @param mixed $userid
 * @return
 */
function xoopsfaq_search($queryarray, $andor, $limit, $offset, $userid)
{
    global $xoopsDB;
    $ret = array();
    if ($userid != 0) {
        return $ret;
    }
    $xfDir = basename(dirname(dirname(__FILE__)));
    $xfContentsHandler =& xoops_getmodulehandler('contents', $xfDir);
    $contentFields = array('contents_id', 'contents_cid', 'contents_title', 'contents_contents', 'contents_publish');
    $criteria = new CriteriaCompo();
    $criteria->add(new Criteria('contents_active', 1, '='));
    $criteria->setSort('contents_id');
    $criteria->setOrder('DESC');
    $criteria->setLimit(intval($limit));
    $criteria->setStart(intval($offset));
    if (is_array($queryarray) && !empty($queryarray)) {
        $criteria->add(new Criteria('contents_title', "%{$queryarray[0]}%", 'LIKE'));
        $criteria->add(new Criteria('contents_contents', "%{$queryarray[0]}%", 'LIKE'), 'OR');
        array_shift($queryarray);
        //get rid of first element
        foreach ($queryarray as $query) {
            $criteria->add(new Criteria('contents_title', "%{$query}%", 'LIKE'), $andor);
            $criteria->add(new Criteria('contents_contents', "%{$query}%", 'LIKE'), 'OR');
        }
    }
    $contentArray = $xfContentsHandler->getAll($criteria, $contentFields, false);
    foreach ($contentArray as $content) {
        $ret[] = array('image' => 'images/question2.gif', 'link' => "index.php?cat_id=" . $content['contents_cid'] . "#" . $content['contents_id'], 'title' => $content['contents_title'], 'time' => $content['contents_publish']);
    }
    unset($contentArray);
    return $ret;
}
Exemplo n.º 14
0
function flash3ComponentsShow($options)
{
    global $xoopsModuleConfig;
    include_once dirname(__FILE__) . "/config.php";
    $sp_handler =& xoops_getmodulehandler('spotlight', 'spotlight');
    $page_handler =& xoops_getmodulehandler('page', 'spotlight');
    // spotlight object
    $sp_obj = $sp_handler->get($options[0]);
    if (!is_object($sp_obj) || empty($options[0])) {
        trigger_error("spotlight is not object ", E_USER_WARNING);
    } else {
        //spotlight name
        $block['sp_name'] = $sp_obj->getVar('sp_name');
    }
    $criteria = new CriteriaCompo();
    $criteria->add(new Criteria('sp_id', $options[0]));
    $criteria->setLimit(5);
    $criteria->setSort('page_order');
    $criteria->setOrder('ASC');
    $pages = $page_handler->getAll($criteria, array('page_id', 'page_title', 'page_link', 'page_image', 'page_desc'), false);
    foreach ($pages as $k => $v) {
        $block['title'][] = $v['page_title'];
        $block['url'][] = $v['page_link'];
        $block['images'][] = XOOPS_UPLOAD_URL . '/spotlight/' . 'thumb_' . $v['page_image'];
    }
    $block['catid'] = $options[0];
    $block['catname'] = $block['sp_name'];
    $block['type'] = 3;
    $block['title'] = implode('|', $block['title']);
    $block['url'] = implode('|', $block['url']);
    $block['images'] = implode('|', $block['images']);
    $block['component'] = $sp_obj->getVar('component_name');
    // xoops_result($block);
    return $block;
}
Exemplo n.º 15
0
function b_categories_list_show($options)
{
    include_once XOOPS_ROOT_PATH . "/modules/smartpartner/include/common.php";
    $smartpartner_category_handler =& smartpartner_gethandler('category');
    $criteria = new CriteriaCompo();
    $criteria->setSort(isset($options[0]) ? $options[0] : 'name');
    $criteria->setOrder(isset($options[1]) ? $options[1] : 'ASC');
    $catsObj =& $smartpartner_category_handler->getobjects($criteria, true);
    $catArray = get_content(0, $catsObj, $options[2]);
    $block = array();
    $block['categories'] = $catArray;
    $block['displaysubs'] = $options[2];
    if (isset($_GET['view_category_id'])) {
        $current_id = $_GET['view_category_id'];
        $block['current'] = $catsObj[$current_id]->getVar('parentid') == 0 ? $current_id : $catsObj[$current_id]->getVar('parentid');
    } elseif (isset($_GET['id'])) {
        $smartpartner_partner_handler =& smartpartner_gethandler('partner');
        $partnerObj = $smartpartner_partner_handler->get($_GET['id']);
        if (is_object($partnerObj)) {
            $parent = $partnerObj->getVar('categoryid');
            $block['current'] = $catsObj[$parent]->getVar('parentid') == 0 ? $parent : $catsObj[$parent]->getVar('parentid');
        }
    }
    return $block;
}
Exemplo n.º 16
0
 /**
  * Export des données
  * @return boolean Vrai si l'export a réussi sinon faux
  */
 function export()
 {
     $def = array(array('o_id', 'N', 10, 0), array('o_uid', 'N', 10, 0), array('o_date', 'D'), array('o_state', 'N', 1, 0), array('o_ip', 'C', 32), array('o_lastname', 'C', 155), array('o_firstnam', 'C', 155), array('o_adress', 'C', 155), array('o_zip', 'C', 30), array('o_town', 'C', 155), array('o_country', 'C', 3), array('o_telephon', 'C', 30), array('o_email', 'C', 155), array('o_articles', 'N', 10, 0), array('o_total', 'N', 10, 2), array('o_shipping', 'N', 10, 2), array('o_bill', 'L'), array('o_password', 'C', 155), array('o_text', 'C', 155), array('o_cancel', 'C', 155), array('c_id', 'N', 10, 0), array('c_prod_id', 'N', 10, 0), array('c_qte', 'N', 10, 0), array('c_price', 'N', 10, 2), array('c_o_id', 'N', 10, 0), array('c_shipping', 'N', 10, 2), array('c_pass', 'C', 155));
     /*
      * Correspondances
      * cmd_id				   o_id
      * cmd_uid                 o_uid
      * cmd_date                o_date
      * cmd_state               o_state
      * cmd_ip                  o_ip
      * cmd_lastname            o_lastname
      * cmd_firstname           o_firstnam
      * cmd_adress              o_adress
      * cmd_zip                 o_zip
      * cmd_town                o_town
      * cmd_country             o_country
      * cmd_telephone           o_telephon
      * cmd_email               o_email
      * cmd_articles_count      o_articles
      * cmd_total               o_total
      * cmd_shipping            o_shipping
      * cmd_bill                o_bill
      * cmd_password            o_password
      * cmd_text                o_text
      * cmd_cancel              o_cancel
      * caddy_id                c_id
      * caddy_product_id        c_prod_id
      * caddy_qte               c_qte
      * caddy_price             c_price
      * caddy_cmd_id            c_o_id
      * caddy_shipping          c_shipping
      * caddy_pass              c_pass
      */
     if (!dbase_create($this->folder . DIRECTORY_SEPARATOR . $this->filename, $def)) {
         $this->success = false;
         return false;
     }
     $dbf = dbase_open($this->folder . DIRECTORY_SEPARATOR . $this->filename, 2);
     if ($dbf === false) {
         $this->success = false;
         return false;
     }
     $criteria = new CriteriaCompo();
     $criteria->add(new Criteria('cmd_id', 0, '<>'));
     $criteria->add(new Criteria('cmd_state', $this->orderType, '='));
     $criteria->setSort('cmd_date');
     $criteria->setOrder('DESC');
     $orders = $this->handlers->h_oledrion_commands->getObjects($criteria);
     foreach ($orders as $order) {
         $carts = array();
         $carts = $this->handlers->h_oledrion_caddy->getObjects(new Criteria('caddy_cmd_id', $order->getVar('cmd_id'), '='));
         foreach ($carts as $cart) {
             dbase_add_record($dbf, array($order->getVar('cmd_id'), $order->getVar('cmd_uid'), date('Ymd', strtotime($order->getVar('cmd_date'))), $order->getVar('cmd_state'), $order->getVar('cmd_ip'), $order->getVar('cmd_lastname'), $order->getVar('cmd_firstname'), $order->getVar('cmd_adress'), $order->getVar('cmd_zip'), $order->getVar('cmd_town'), $order->getVar('cmd_country'), $order->getVar('cmd_telephone'), $order->getVar('cmd_email'), $order->getVar('cmd_articles_count'), $order->getVar('cmd_total'), $order->getVar('cmd_shipping'), $order->getVar('cmd_bill'), $order->getVar('cmd_password'), $order->getVar('cmd_text'), $order->getVar('cmd_cancel'), $cart->getVar('caddy_id'), $cart->getVar('caddy_product_id'), $cart->getVar('caddy_qte'), $cart->getVar('caddy_price'), $cart->getVar('caddy_cmd_id'), $cart->getVar('caddy_shipping'), $cart->getVar('caddy_pass')));
         }
     }
     dbase_close($dbf);
     $this->success = true;
     return true;
 }
Exemplo n.º 17
0
 /**
  * @得到列表
  * @method:
  * @license http://www.blags.org/
  * @created:2010年05月23日 14时59分
  * @copyright 1997-2010 The Martin Group
  * @author Martin <*****@*****.**> 
  * */
 function &getHotelServiceTypes($limit = 0, $start = 0, $sort = 'service_type_id', $order = 'ASC', $id_as_key = true)
 {
     $criteria = new CriteriaCompo();
     $criteria->setSort($sort);
     $criteria->setOrder($order);
     $criteria->setStart($start);
     $criteria->setLimit($limit);
     return $this->getObjects($criteria, $id_as_key);
 }
Exemplo n.º 18
0
 public function getLatestRevision($pageId, $status = Lenum_Status::PROGRESS)
 {
     $cri = new CriteriaCompo();
     $cri->add(new Criteria('page_id', $pageId));
     $cri->add(new Criteria('status', $status, '>='));
     $cri->setSort('revision_id', 'DESC');
     $objs = $this->getObjects($cri);
     return count($objs) > 0 ? array_shift($objs) : null;
 }
Exemplo n.º 19
0
function press_block_category_show($options)
{
    $category_handler = xoops_getmodulehandler("category", "press");
    $criteria = new CriteriaCompo();
    $criteria->setSort('cat_id');
    $criteria->setOrder('ASC');
    $block = $category_handler->getList($criteria);
    return $block;
}
Exemplo n.º 20
0
 public function countRelated($start = 0, $limit = 0, $sort = 'related_name', $order = 'ASC')
 {
     $criteria = new CriteriaCompo();
     $criteria->setSort($sort);
     $criteria->setOrder($order);
     $criteria->setStart($start);
     $criteria->setLimit($limit);
     return parent::getCount();
 }
Exemplo n.º 21
0
function banners_blocks_edit($options)
{
    $form = '';
    switch ($options[0]) {
        case 'random':
            $form .= _MB_BANNERS_DISP . "&nbsp;\n";
            $form .= "<input type=\"hidden\" name=\"options[0]\" value=\"" . $options[0] . "\" />\n";
            $form .= "<input name=\"options[1]\" size=\"5\" maxlength=\"255\" value=\"" . $options[1] . "\" type=\"text\" />&nbsp;" . _MB_BANNERS . "<br />\n";
            switch ($options[2]) {
                case 'H':
                    $checked_H = 'checked="checked"';
                    $checked_V = '';
                    break;
                case 'V':
                    $checked_H = '';
                    $checked_V = 'checked="checked"';
                    break;
            }
            $form .= _MB_BANNERS_ALIGNEMENT . " : <input name=\"options[2]\" value=\"H\" type=\"radio\" " . $checked_H . "/>" . _MB_BANNERS_ALIGNEMENT_H . "&nbsp;\n";
            $form .= "<input name=\"options[2]\" value=\"V\" type=\"radio\" " . $checked_V . "/>" . _MB_BANNERS_ALIGNEMENT_V . "<br />\n";
            array_shift($options);
            array_shift($options);
            array_shift($options);
            $form .= _MB_BANNERS_CLIENTSTODISPLAY . "<br /><select name=\"options[]\" multiple=\"multiple\" size=\"5\">\n";
            $xoops = Xoops::getInstance();
            $client_Handler = $xoops->getModuleHandler('bannerclient', 'banners');
            $criteria = new CriteriaCompo();
            $criteria->setSort('bannerclient_name');
            $criteria->setOrder('ASC');
            $client_arr = $client_Handler->getAll($criteria);
            $form .= "<option value=\"0\" " . (array_search(0, $options) === false ? '' : 'selected="selected"') . ">" . _MB_BANNERS_ALLCLIENTS . "</option>\n";
            foreach (array_keys($client_arr) as $i) {
                $form .= "<option value=\"" . $client_arr[$i]->getVar('cid') . "\" " . (array_search($client_arr[$i]->getVar('cid'), $options) === false ? '' : 'selected="selected"') . ">" . $client_arr[$i]->getVar('name') . "</option>\n";
            }
            $form .= "</select>\n";
            break;
        case 'id':
            $form .= _MB_BANNERS_IDDISPLAY . "&nbsp;\n";
            $form .= "<input type=\"hidden\" name=\"options[0]\" value=\"" . $options[0] . "\" />\n";
            $form .= "<input name=\"options[1]\" size=\"20\" maxlength=\"255\" value=\"" . $options[1] . "\" type=\"text\" />&nbsp;" . _MB_BANNERS_SEP . "<br />\n";
            switch ($options[2]) {
                case 'H':
                    $checked_H = 'checked="checked"';
                    $checked_V = '';
                    break;
                case 'V':
                    $checked_H = '';
                    $checked_V = 'checked="checked"';
                    break;
            }
            $form .= _MB_BANNERS_ALIGNEMENT . " : <input name=\"options[2]\" value=\"H\" type=\"radio\" " . $checked_H . "/>" . _MB_BANNERS_ALIGNEMENT_H . "&nbsp;\n";
            $form .= "<input name=\"options[2]\" value=\"V\" type=\"radio\" " . $checked_V . "/>" . _MB_BANNERS_ALIGNEMENT_V . "<br />\n";
            break;
    }
    return $form;
}
Exemplo n.º 22
0
 function setContent($isreturn = false)
 {
     global $jieqiTpl;
     global $jieqiConfigs;
     jieqi_getconfigs('article', 'configs');
     $article_static_url = empty($jieqiConfigs['article']['staticurl']) ? $GLOBALS['jieqiModules']['article']['url'] : $jieqiConfigs['article']['staticurl'];
     $article_dynamic_url = empty($jieqiConfigs['article']['dynamicurl']) ? $GLOBALS['jieqiModules']['article']['url'] : $jieqiConfigs['article']['dynamicurl'];
     $jieqiTpl->assign('article_static_url', $article_static_url);
     $jieqiTpl->assign('article_dynamic_url', $article_dynamic_url);
     jieqi_includedb();
     $query = JieqiQueryHandler::getInstance('JieqiQueryHandler');
     $criteria = new CriteriaCompo();
     $criteria->setFields("r.*,a.articlename");
     $criteria->setTables(jieqi_dbprefix('article_reviews') . " AS r LEFT JOIN " . jieqi_dbprefix('article_article') . " AS a ON r.ownerid=a.articleid");
     if ($this->exevars['istop'] == 1) {
         $criteria->add(new Criteria('r.istop', '1'));
     } elseif ($this->exevars['istop'] == 2) {
         $criteria->add(new Criteria('r.istop', '0'));
     }
     if ($this->exevars['isgood'] == 1) {
         $criteria->add(new Criteria('r.isgood', '1'));
     } elseif ($this->exevars['isgood'] == 2) {
         $criteria->add(new Criteria('r.isgood', '0'));
     }
     $criteria->setSort('r.topicid');
     $criteria->setOrder('DESC');
     $criteria->setLimit($this->exevars['listnum']);
     $criteria->setStart(0);
     $query->queryObjects($criteria);
     $reviewrows = array();
     $i = 0;
     while ($v = $query->getObject()) {
         $reviewrows[$i]['reviewtitle'] = jieqi_htmlstr(str_replace(array("\r", "\n"), array('', ' '), $v->getVar('title', 'n')));
         $reviewrows[$i]['ownerid'] = $v->getVar('ownerid');
         $reviewrows[$i]['articlename'] = $v->getVar('articlename');
         $reviewrows[$i]['topicid'] = $v->getVar('topicid');
         $reviewrows[$i]['url_review'] = $article_dynamic_url . '/reviews.php?aid=' . $v->getVar('ownerid');
         $reviewrows[$i]['poster'] = $v->getVar('poster');
         $reviewrows[$i]['posterid'] = $v->getVar('posterid');
         $reviewrows[$i]['postdate'] = date('m-d H:i', $v->getVar('posttime'));
         $reviewrows[$i]['posttime'] = $v->getVar('posttime');
         $reviewrows[$i]['replytime'] = $v->getVar('replytime');
         $reviewrows[$i]['views'] = $v->getVar('views');
         $reviewrows[$i]['replies'] = $v->getVar('replies');
         $reviewrows[$i]['islock'] = $v->getVar('islock');
         $reviewrows[$i]['istop'] = $v->getVar('istop');
         $reviewrows[$i]['isgood'] = $v->getVar('isgood');
         $reviewrows[$i]['topictype'] = $v->getVar('topictype');
         $reviewrows[$i]['url_articleinfo'] = jieqi_geturl('article', 'article', $v->getVar('ownerid'), 'info');
         $reviewrows[$i]['url_articleindex'] = jieqi_geturl('article', 'article', $v->getVar('ownerid'), 'index');
         $reviewrows[$i]['url_articleread'] = $reviewrows[$i]['url_articleindex'];
         $i++;
     }
     $jieqiTpl->assign_by_ref('reviewrows', $reviewrows);
     $jieqiTpl->assign('url_more', $article_dynamic_url . '/reviewslist.php');
 }
Exemplo n.º 23
0
 /**
  * Private helper functions for traversing the category tree
  *
  * @param int $parentid ID to start from
  * @param int $level used in recursions
  * @param int $offset integer added to location
  *
  * @return void
  */
 function getPageHelper($parentid = 0, $level = 0)
 {
     $page_handler =& xoops_getmodulehandler('page', 'alexandria');
     $criteria = new CriteriaCompo();
     $criteria->setSort('page_title');
     $page_arr =& $page_handler->getObjects($criteria);
     include_once XOOPS_ROOT_PATH . "/class/tree.php";
     $tree = new XoopsObjectTree($page_arr, 'page_id', 'page_parent');
     $this->traversePageTree($tree, $parentid, $level);
 }
Exemplo n.º 24
0
 /**
  * Private helper functions for traversing the category tree
  *
  * @param int $parentid ID to start from
  * @param int $level used in recursions
  * @param int $offset integer added to location
  *
  * @return void
  */
 function getPageHelper($parentid = 0, $level = 0)
 {
     $cat_handler =& xoops_getmodulehandler('category', 'smartsection');
     $criteria = new CriteriaCompo();
     $criteria->setSort('name');
     $cat_arr =& $cat_handler->getObjects($criteria);
     include_once XOOPS_ROOT_PATH . "/class/tree.php";
     $tree = new XoopsObjectTree($cat_arr, 'categoryid', 'parentid');
     $this->traversePageTree($tree, $parentid, $level);
 }
Exemplo n.º 25
0
 function linksForm($action = false)
 {
     global $xoopsModuleConfig;
     if ($action === false) {
         $action = $_SERVER['REQUEST_URI'];
     }
     include_once XOOPS_ROOT_PATH . "/class/xoopsformloader.php";
     $title = $this->isNew() ? _AM_LINKS_ADDLIK : _AM_LINKS_UPDATELIK;
     $link_status = $this->isNew() ? 1 : $this->getVar('link_status');
     $form = new XoopsThemeForm($title, 'form', $action, 'post', true);
     $form->setExtra('enctype="multipart/form-data"');
     $cat_id = isset($_REQUEST['cid']) ? $_REQUEST['cid'] : '';
     if (empty($cat_id)) {
         $cat_id = $this->getVar("cat_id");
     }
     $categories = new XoopsFormSelect(_AM_LINKS_CATNAME, 'cat_id', $cat_id);
     $cat_handler = xoops_getmodulehandler('category', 'links');
     $criteria = new CriteriaCompo();
     $criteria->setSort('cat_order');
     $criteria->setOrder('ASC');
     $categories->addOptionArray($cat_handler->getList($criteria));
     $form->addElement($categories, true);
     $form->addElement(new XoopsFormText(_AM_LINKS_TITLE, 'link_title', 40, 50, $this->getVar('link_title')), true);
     if (!$this->isNew()) {
         $form->addElement(new XoopsFormText(_AM_LINKS_LIKADD, 'link_url', 80, 5000, $this->getVar('link_url'), true));
         $form->addElement(new XoopsFormHidden('datetime', time()));
     } else {
         $form->addElement(new XoopsFormText(_AM_LINKS_LIKADD, 'link_url', 80, 5000, 'http://'), true);
         $form->addElement(new XoopsFormHidden('published', time()));
         $form->addElement(new XoopsFormHidden('datetime', time()));
     }
     $logo_image = new XoopsFormElementTray(_AM_LINKS_LIKLOGO);
     if (!empty($xoopsModuleConfig['logo'])) {
         if ($this->getVar('link_title')) {
             $logo_image->addElement(new XoopsFormLabel('', '<img src="' . XOOPS_URL . $xoopsModuleConfig['logo_dir'] . $this->getVar('link_image') . '"><br><br>'));
             $display = _AM_LINKS_LOGOWARN;
         } else {
             $display = '';
         }
         $logo_image->addElement(new XoopsFormFile('', 'link_image', 1024 * 1024 * 2));
     } else {
         $logo_image->addElement(new XoopsFormText('', 'link_dir', 70, 255, $this->getVar('link_dir')));
         $display = _AM_LINKS_LOGOTIPS . XOOPS_URL . '/uploads/logo/logo.jpg';
     }
     $logo_image->addElement(new XoopsFormLabel('', $display));
     $form->addElement($logo_image);
     $form->addElement(new XoopsFormText(_AM_LINKS_SORT, 'link_order', 4, 2, $this->getVar('link_order')));
     $form->addElement(new XoopsFormText(_AM_LINKS_CONTACT, 'link_contact', 60, 255, $this->getVar('link_contact')));
     $form->addElement(new XoopsFormRadioYN(_AM_LINKS_SHOW, 'link_status', $link_status));
     $form->addElement(new XoopsFormHidden('link_id', $this->getVar('link_id')));
     $form->addElement(new XoopsFormHidden('ac', 'insert'));
     $form->addElement(new XoopsFormButton('', 'submit', _SUBMIT, 'submit'));
     return $form;
 }
Exemplo n.º 26
0
    public function search($queries, $andor, $limit, $start, $userid)
    {
        $xoops = Xoops::getInstance();
        $alumni = Alumni::getInstance();
        $myts = MyTextSanitizer::getInstance();
        $by_cat = Request::getInt('by_cat', '');
        $andor = Request::getWord('andor', 'AND');
        $queries = array();
        $query = Request::getString('query', '');
        $start = Request::getInt('start', '0');
        $helper = $xoops->getModuleHelper('alumni');
        $module_id = $helper->getModule()->getVar('mid');
        $listingHandler = $helper->getHandler('listing');
        $groups = $xoops->getUserGroups();
        $alumni_ids = $xoops->getHandlerGroupperm()->getItemIds('alumni_view', $groups, $module_id);
        $all_ids = implode(', ', $alumni_ids);
        $criteria = new CriteriaCompo();
        $criteria->add(new Criteria('valid', 1, '='));
        //  $criteria->add(new Criteria('date', time(), '<='));
        $criteria->add(new Criteria('cid', '(' . $all_ids . ')', 'IN'));
        if ($userid != 0) {
            $criteria->add(new Criteria('usid', $userid, '='));
        }
        if ($by_cat) {
            $criteria->add(new Criteria('cid', $by_cat, '='));
        }
        $queries = array($query);
        $queries = implode('+', $queries);
        $count = 0;
        $i = 0;
        $criteria->add(new Criteria('name', '%' . $queries . '%', 'LIKE'), 'AND');
        $criteria->add(new Criteria('mname', '%' . $queries . '%', 'LIKE'), 'OR');
        $criteria->add(new Criteria('lname', '%' . $queries . '%', 'LIKE'), 'OR');
        $criteria->add(new Criteria('school', '%' . $queries . '%', 'LIKE'), 'OR');
        $criteria->add(new Criteria('year', '%' . $queries . '%', 'LIKE'), 'OR');
        $criteria->setLimit($limit);
        $criteria->setSort('date');
        $criteria->setOrder('DESC');
        $criteria->setStart($start);
        $numrows = $listingHandler->getCount();
        $this_search = $listingHandler->getall($criteria);
        $ret = array();
        $k = 0;
        foreach ($this_search as $obj) {
            $ret[$k]['image'] = 'images/cat/default.gif';
            $ret[$k]['link'] = 'listing.php?lid=' . $obj->getVar('lid') . '';
            $ret[$k]['title'] = $obj->getVar('name') . ' ' . $obj->getVar('mname') . ' ' . $obj->getVar('lname') . '   ---   ' . $obj->getVar('school') . '
		---   ' . $obj->getVar('year');
            $ret[$k]['time'] = $obj->getVar('date');
            $ret[$k]['uid'] = $obj->getVar('usid');
            $k++;
        }
        return $ret;
    }
Exemplo n.º 27
0
 function getSavedVars($modname)
 {
     global $jieqiRight;
     $criteria = new CriteriaCompo(new Criteria('modname', $modname, '='));
     $criteria->setSort('rid');
     $criteria->setOrder('ASC');
     $this->queryObjects($criteria);
     while ($v = $this->getObject()) {
         $jieqiRight[$modname][$v->getVar('rname', 'n')] = array('caption' => $v->getVar('rtitle'), 'honors' => unserialize($v->getVar('rhonors', 'n')), 'rescription' => $v->getVar('rdescription'));
     }
 }
Exemplo n.º 28
0
 function getSavedVars($modname)
 {
     global $jieqiPower;
     $criteria = new CriteriaCompo(new Criteria('modname', $modname, '='));
     $criteria->setSort('pid');
     $criteria->setOrder('ASC');
     $this->queryObjects($criteria);
     while ($v = $this->getObject()) {
         $jieqiPower[$modname][$v->getVar('pname', 'n')] = array('caption' => $v->getVar('ptitle'), 'groups' => unserialize($v->getVar('pgroups', 'n')), 'description' => $v->getVar('pdescription'));
     }
 }
Exemplo n.º 29
0
 function pruneShouts($limit)
 {
     $criteria = new CriteriaCompo();
     $criteria->setSort('id');
     $criteria->setOrder('DESC');
     $criteria->setStart(0);
     $criteria->setLimit($limit);
     $objs = $this->getList($criteria, true);
     unset($criteria);
     $criteria = new Criteria('id', '(' . implode(',', array_keys($objs)) . ')', 'NOT IN');
     return $this->deleteAll($criteria);
 }
Exemplo n.º 30
0
 /**
  * Export des données
  * @return boolean Vrai si l'export a réussi sinon faux
  */
 function export()
 {
     $file = $this->folder . DIRECTORY_SEPARATOR . $this->filename;
     $fp = fopen($file, 'w');
     if (!$fp) {
         $this->success = false;
         return false;
     }
     // Création de l'entête du fichier
     $list = $entete1 = $entete2 = array();
     $s = $this->separator;
     $cmd = new oledrion_commands();
     foreach ($cmd->getVars() as $fieldName => $properties) {
         $entete1[] = $fieldName;
     }
     // Ajout des infos de caddy
     $cart = new oledrion_caddy();
     foreach ($cart->getVars() as $fieldName => $properties) {
         $entete2[] = $fieldName;
     }
     $list[] = array_merge($entete1, $entete2);
     // make item array
     $criteria = new CriteriaCompo();
     $criteria->add(new Criteria('cmd_id', 0, '<>'));
     $criteria->add(new Criteria('cmd_state', $this->orderType, '='));
     $criteria->setSort('cmd_date');
     $criteria->setOrder('DESC');
     $orders = $this->handlers->h_oledrion_commands->getObjects($criteria);
     foreach ($orders as $order) {
         $carts = array();
         $carts = $this->handlers->h_oledrion_caddy->getObjects(new Criteria('caddy_cmd_id', $order->getVar('cmd_id'), '='));
         $ligne = array();
         foreach ($carts as $cart) {
             $ligne = array();
             foreach ($entete1 as $commandField) {
                 $ligne[] = $order->getVar($commandField);
             }
             foreach ($entete2 as $cartField) {
                 $ligne[] = $cart->getVar($cartField);
             }
             // Add to main array
             $list[] = $ligne;
         }
     }
     // import information on csv file
     foreach ($list as $fields) {
         fputcsv($fp, $fields);
     }
     fclose($fp);
     $this->success = true;
     return true;
 }