示例#1
0
文件: module.php 项目: cwcw/cms
/**
* @param string The URL option
*/
function showInstalledModules($_option)
{
    global $database, $mosConfig_absolute_path, $adminLanguage;
    $filter = mosGetParam($_POST, 'filter', '');
    $select[] = mosHTML::makeOption('', $adminLanguage->A_COMP_MOD_ALL);
    $select[] = mosHTML::makeOption('0', $adminLanguage->A_MENU_SITE_MOD);
    $select[] = mosHTML::makeOption('1', $adminLanguage->A_INSTALL_MOD_ADMIN_MOD);
    $lists['filter'] = mosHTML::selectList($select, 'filter', 'class="inputbox" size="1" onchange="document.adminForm.submit();"', 'value', 'text', $filter);
    if ($filter == NULL) {
        $and = '';
    } else {
        if (!$filter) {
            $and = "\n AND client_id = '0'";
        } else {
            if ($filter) {
                $and = "\n AND client_id = '1'";
            }
        }
    }
    $database->setQuery("SELECT id, module, client_id" . "\n FROM #__modules" . "\n WHERE module LIKE 'mod_%' AND iscore='0'" . $and . "\n GROUP BY module, client_id" . "\n ORDER BY client_id, module");
    $rows = $database->loadObjectList();
    $id = 0;
    foreach ($rows as $row) {
        // path to module directory
        if ($row->client_id == "1") {
            $moduleBaseDir = mosPathName(mosPathName($mosConfig_absolute_path) . "administrator/modules");
        } else {
            $moduleBaseDir = mosPathName(mosPathName($mosConfig_absolute_path) . "modules");
        }
        // xml file for module
        $xmlfile = $moduleBaseDir . "/" . $row->module . ".xml";
        $xmlDoc =& new DOMIT_Lite_Document();
        $xmlDoc->resolveErrors(true);
        if (!$xmlDoc->loadXML($xmlfile, false, true)) {
            continue;
        }
        $element =& $xmlDoc->documentElement;
        if ($element->getTagName() != 'mosinstall') {
            continue;
        }
        if ($element->getAttribute("type") != "module") {
            continue;
        }
        $element =& $xmlDoc->getElementsByPath('creationDate', 1);
        $row->creationdate = $element ? $element->getText() : '';
        $element =& $xmlDoc->getElementsByPath('author', 1);
        $row->author = $element ? $element->getText() : '';
        $element =& $xmlDoc->getElementsByPath('copyright', 1);
        $row->copyright = $element ? $element->getText() : '';
        $element =& $xmlDoc->getElementsByPath('authorEmail', 1);
        $row->authorEmail = $element ? $element->getText() : '';
        $element =& $xmlDoc->getElementsByPath('authorUrl', 1);
        $row->authorUrl = $element ? $element->getText() : '';
        $element =& $xmlDoc->getElementsByPath('version', 1);
        $row->version = $element ? $element->getText() : '';
        $rows[$id] = $row;
        $id++;
    }
    HTML_module::showInstalledModules($rows, $_option, $id, $xmlfile, $lists);
}
示例#2
0
 public static function makeOption($value, $text = '', $value_name = 'value', $text_name = 'text')
 {
     if (JCOMMENTS_JVERSION == '1.0') {
         return mosHTML::makeOption($value, $text, $value_name, $text_name);
     }
     return JHTML::_('select.option', $value, $text, $value_name, $text_name);
 }
示例#3
0
function fetchSearchForm($gid, $itemid)
{
    global $search_mode, $ordering, $invert_search, $reverse_order, $search_where, $search_phrase, $search_catid;
    // category select list
    $options = array(mosHTML::makeOption('0', _DML_ALLCATS));
    $lists['catid'] = dmHTML::categoryList($search_catid, "", $options);
    $mode = array();
    $mode[] = mosHTML::makeOption('any', _DML_SEARCH_ANYWORDS);
    $mode[] = mosHTML::makeOption('all', _DML_SEARCH_ALLWORDS);
    $mode[] = mosHTML::makeOption('exact', _DML_SEARCH_PHRASE);
    $mode[] = mosHTML::makeOption('regex', _DML_SEARCH_REGEX);
    $lists['search_mode'] = mosHTML::selectList($mode, 'search_mode', 'id="search_mode" class="inputbox"', 'value', 'text', $search_mode);
    $orders = array();
    $orders[] = mosHTML::makeOption('newest', _DML_SEARCH_NEWEST);
    $orders[] = mosHTML::makeOption('oldest', _DML_SEARCH_OLDEST);
    $orders[] = mosHTML::makeOption('popular', _DML_SEARCH_POPULAR);
    $orders[] = mosHTML::makeOption('alpha', _DML_SEARCH_ALPHABETICAL);
    $orders[] = mosHTML::makeOption('category', _DML_SEARCH_CATEGORY);
    $lists['ordering'] = mosHTML::selectList($orders, 'ordering', 'id="ordering" class="inputbox"', 'value', 'text', $ordering);
    $lists['invert_search'] = '<input type="checkbox" class="inputbox" name="invert_search" ' . ($invert_search ? ' checked ' : '') . '/>';
    $lists['reverse_order'] = '<input type="checkbox" class="inputbox" name="reverse_order" ' . ($reverse_order ? ' checked ' : '') . '/>';
    $matches = array();
    if ($search_where && count($search_where) > 0) {
        foreach ($search_where as $val) {
            $matches[] = mosHTML::makeOption($val, $val);
        }
    } else {
        $matches[] = mosHTML::makeOption('search_description', 'search_description');
    }
    $where = array();
    $where[] = mosHTML::makeOption('search_name', _DML_NAME);
    $where[] = mosHTML::makeOption('search_description', _DML_DESCRIPTION);
    $lists['search_where'] = mosHTML::selectList($where, 'search_where[]', 'id="search_where" class="inputbox" multiple="multiple" size="2"', 'value', 'text', $where);
    return HTML_DMSearch::searchForm($lists, $search_phrase);
}
示例#4
0
function editGroup($option, $uid)
{
    global $database;
    // disable the main menu to force user to use buttons
    $_REQUEST['hidemainmenu'] = 1;
    $row = new mosDMGroups($database);
    $row->load($uid);
    $musers = array();
    $toAddUsers = array();
    // get selected members
    if ($row->groups_members) {
        $database->setQuery("SELECT id,name,username, block " . "\n FROM #__users " . "\n WHERE id IN (" . $row->groups_members . ")" . "\n ORDER BY block ASC, name ASC");
        $usersInGroup = $database->loadObjectList();
        foreach ($usersInGroup as $user) {
            $musers[] = mosHTML::makeOption($user->id, $user->id . "-" . $user->name . " (" . $user->username . ")" . ($user->block ? ' - [' . _DML_USER_BLOCKED . ']' : ''));
        }
    }
    // get non selected members
    $query = "SELECT id,name,username, block FROM #__users ";
    if ($row->groups_members) {
        $query .= "\n WHERE id NOT IN (" . $row->groups_members . ")";
    }
    $query .= "\n ORDER BY block ASC, name ASC";
    $database->setQuery($query);
    $usersToAdd = $database->loadObjectList();
    foreach ($usersToAdd as $user) {
        $toAddUsers[] = mosHTML::makeOption($user->id, $user->id . "-" . $user->name . " (" . $user->username . ")" . ($user->block ? ' - [' . _DML_USER_BLOCKED . ']' : ''));
    }
    $usersList = mosHTML::selectList($musers, 'users_selected[]', 'class="inputbox" size="20" onDblClick="moveOptions(document.adminForm[\'users_selected[]\'], document.adminForm.users_not_selected)" multiple="multiple"', 'value', 'text', null);
    $toAddUsersList = mosHTML::selectList($toAddUsers, 'users_not_selected', 'class="inputbox" size="20" onDblClick="moveOptions(document.adminForm.users_not_selected, document.adminForm[\'users_selected[]\'])" multiple="multiple"', 'value', 'text', null);
    HTML_DMGroups::editGroup($option, $row, $usersList, $toAddUsersList);
}
示例#5
0
function messageForm($option)
{
    global $database, $acl;
    $gtree = array(mosHTML::makeOption(0, $adminLanguage->A_COMP_MASS_ALL));
    // get list of groups
    $lists = array();
    $gtree = array_merge($gtree, $acl->get_group_children_tree(null, 'USERS', false));
    $lists['gid'] = mosHTML::selectList($gtree, 'mm_group', 'size="10"', 'value', 'text', 0);
    HTML_massmail::messageForm($lists, $option);
}
示例#6
0
 /**
  * @param string The name of the form element
  * @param string The value of the element
  * @param object The xml element for the parameter
  * @param string The control name
  * @return string The html for the element
  */
 function _form_editor_list($name, $value, &$node, $control_name)
 {
     global $database;
     // compile list of the editors
     $query = "SELECT element AS value, name AS text" . "\n FROM #__mambots" . "\n WHERE folder = 'editors'" . "\n AND published = 1" . "\n ORDER BY ordering, name";
     $database->setQuery($query);
     $editors = $database->loadObjectList();
     array_unshift($editors, mosHTML::makeOption('', '- Selecionar Editor -'));
     return mosHTML::selectList($editors, '' . $control_name . '[' . $name . ']', 'class="inputbox"', 'value', 'text', $value);
 }
示例#7
0
function messageForm($option)
{
    global $acl;
    $gtree = array(mosHTML::makeOption(0, '- All User Groups -'));
    // get list of groups
    $lists = array();
    $gtree = array_merge($gtree, $acl->get_group_children_tree(null, 'USERS', false));
    $lists['gid'] = mosHTML::selectList($gtree, 'mm_group', 'size="10"', 'value', 'text', 0);
    HTML_massmail::messageForm($lists, $option);
}
示例#8
0
 /**
  * Returns the html limit # input box
  * @param string The basic link to include in the href
  * @return string
  */
 function getLimitBox($link)
 {
     $limits = array();
     for ($i = 5; $i <= 30; $i += 5) {
         $limits[] = mosHTML::makeOption("{$i}");
     }
     $limits[] = mosHTML::makeOption("50");
     // build the html select list
     $link = sefRelToAbs($link . '&amp;limit=\' + this.options[selectedIndex].value + \'&amp;limitstart=' . $this->limitstart);
     return mosHTML::selectList($limits, 'limit', 'class="inputbox" size="1" onchange="document.location.href=\'' . $link . '\';"', 'value', 'text', $this->limit);
 }
 /**
  * @param database A database connector object
  * @param integer The unique id of the category to edit (0 if new)
  */
 function edit(&$uid, $menutype, $option)
 {
     global $database, $my, $mainframe;
     $menu = new mosMenu($database);
     $menu->load((int) $uid);
     // fail if checked out not by 'me'
     if ($menu->checked_out && $menu->checked_out != $my->id) {
         mosErrorAlert("The module " . $menu->title . " is currently being edited by another administrator");
     }
     if ($uid) {
         $menu->checkout($my->id);
         // get previously selected Categories
         $params = new mosParameters($menu->params);
         $catids = $params->def('categoryid', '');
         if ($catids) {
             $catidsArray = explode(',', $catids);
             mosArrayToInts($catidsArray);
             $catids = 'c.id=' . implode(' OR c.id=', $catidsArray);
             $query = "SELECT c.id AS `value`, c.section AS `id`, CONCAT_WS( ' / ', s.title, c.title) AS `text`" . "\n FROM #__sections AS s" . "\n INNER JOIN #__categories AS c ON c.section = s.id" . "\n WHERE s.scope = 'content'" . "\n AND ( {$catids} )" . "\n ORDER BY s.name,c.name";
             $database->setQuery($query);
             $lookup = $database->loadObjectList();
         } else {
             $lookup = '';
         }
     } else {
         $menu->type = 'content_blog_category';
         $menu->menutype = $menutype;
         $menu->ordering = 9999;
         $menu->parent = intval(mosGetParam($_POST, 'parent', 0));
         $menu->published = 1;
         $lookup = '';
     }
     // build the html select list for category
     $rows[] = mosHTML::makeOption('', 'All Categories');
     $query = "SELECT c.id AS `value`, c.section AS `id`, CONCAT_WS( ' / ', s.title, c.title) AS `text`" . "\n FROM #__sections AS s" . "\n INNER JOIN #__categories AS c ON c.section = s.id" . "\n WHERE s.scope = 'content'" . "\n ORDER BY s.name,c.name";
     $database->setQuery($query);
     $rows = array_merge($rows, $database->loadObjectList());
     $category = mosHTML::selectList($rows, 'catid[]', 'class="inputbox" size="10" multiple="multiple"', 'value', 'text', $lookup);
     $lists['categoryid'] = $category;
     // build the html select list for ordering
     $lists['ordering'] = mosAdminMenus::Ordering($menu, $uid);
     // build the html select list for the group access
     $lists['access'] = mosAdminMenus::Access($menu);
     // build the html select list for paraent item
     $lists['parent'] = mosAdminMenus::Parent($menu);
     // build published button option
     $lists['published'] = mosAdminMenus::Published($menu);
     // build the url link output
     $lists['link'] = mosAdminMenus::Link($menu, $uid);
     // get params definitions
     $params = new mosParameters($menu->params, $mainframe->getPath('menu_xml', $menu->type), 'menu');
     /* chipjack: passing $sectCatList (categories) instead of $slist (sections) */
     content_blog_category_html::edit($menu, $lists, $params, $option);
 }
 /**
  * @param database A database connector object
  * @param integer The unique id of the section to edit (0 if new)
  */
 function edit($uid, $menutype, $option)
 {
     global $database, $my, $mainframe;
     $menu = new mosMenu($database);
     $menu->load((int) $uid);
     // fail if checked out not by 'me'
     if ($menu->checked_out && $menu->checked_out != $my->id) {
         mosErrorAlert("O módulo " . $menu->title . " está sendo editado atualmente por outro administrador");
     }
     if ($uid) {
         $menu->checkout($my->id);
         // get previously selected Categories
         $params = new mosParameters($menu->params);
         $secids = $params->def('sectionid', '');
         if ($secids) {
             $secidsArray = explode(',', $secids);
             mosArrayToInts($secidsArray);
             $secids = 's.id=' . implode(' OR s.id=', $secidsArray);
             $query = "SELECT s.id AS `value`, s.id AS `id`, s.title AS `text`" . "\n FROM #__sections AS s" . "\n WHERE s.scope = 'content'" . "\n AND ( {$secids} )" . "\n ORDER BY s.name";
             $database->setQuery($query);
             $lookup = $database->loadObjectList();
         } else {
             $lookup = '';
         }
     } else {
         $menu->type = 'content_blog_section';
         $menu->menutype = $menutype;
         $menu->ordering = 9999;
         $menu->parent = intval(mosGetParam($_POST, 'parent', 0));
         $menu->published = 1;
         $lookup = '';
     }
     // build the html select list for section
     $rows[] = mosHTML::makeOption('', 'Todas as Seções');
     $query = "SELECT s.id AS `value`, s.id AS `id`, s.title AS `text`" . "\n FROM #__sections AS s" . "\n WHERE s.scope = 'content'" . "\n ORDER BY s.name";
     $database->setQuery($query);
     $rows = array_merge($rows, $database->loadObjectList());
     $section = mosHTML::selectList($rows, 'secid[]', 'class="inputbox" size="10" multiple="multiple"', 'value', 'text', $lookup);
     $lists['sectionid'] = $section;
     // build the html select list for ordering
     $lists['ordering'] = mosAdminMenus::Ordering($menu, $uid);
     // build the html select list for the group access
     $lists['access'] = mosAdminMenus::Access($menu);
     // build the html select list for paraent item
     $lists['parent'] = mosAdminMenus::Parent($menu);
     // build published button option
     $lists['published'] = mosAdminMenus::Published($menu);
     // build the url link output
     $lists['link'] = mosAdminMenus::Link($menu, $uid);
     // get params definitions
     $params = new mosParameters($menu->params, $mainframe->getPath('menu_xml', $menu->type), 'menu');
     content_blog_section_html::edit($menu, $lists, $params, $option);
 }
示例#11
0
function dbBackup($p_option)
{
    global $database;
    $database->setQuery("SHOW tables");
    $tables = $database->loadResultArray();
    $tables2 = array(mosHTML::makeOption('all', T_('All Mambo Tables')));
    foreach ($tables as $table) {
        $tables2[] = mosHTML::makeOption($table);
    }
    $tablelist = mosHTML::selectList($tables2, 'tables[]', 'class="inputbox" size="5" multiple="multiple"', 'value', 'text', 'all');
    HTML_dbadmin::backupIntro($tablelist, $p_option);
}
示例#12
0
 /**
  * @param database A database connector object
  * @param integer The unique id of the section to edit (0 if new)
  */
 function edit(&$uid, $menutype, $option)
 {
     global $database, $my, $mainframe;
     global $mosConfig_absolute_path;
     $menu = new mosMenu($database);
     $menu->load($uid);
     // fail if checked out not by 'me'
     if ($menu->checked_out && $menu->checked_out != $my->id) {
         echo "<script>alert('The module {$menu->title} is currently being edited by another administrator'); document.location.href='index2.php?option={$option}'</script>\n";
         exit(0);
     }
     if ($uid) {
         $menu->checkout($my->id);
         // get previously selected Categories
         $params =& new mosParameters($menu->params);
         $secids = $params->def('sectionid', '');
         if ($secids) {
             $query = "SELECT s.id AS `value`, s.id AS `id`, s.title AS `text`" . "\n FROM #__sections AS s" . "\n WHERE s.scope = 'content'" . "\n AND s.id IN ( " . $secids . ")" . "\n ORDER BY s.name";
             $database->setQuery($query);
             $lookup = $database->loadObjectList();
         } else {
             $lookup = '';
         }
     } else {
         $menu->type = 'content_blog_section';
         $menu->menutype = $menutype;
         $menu->ordering = 9999;
         $menu->parent = intval(mosGetParam($_POST, 'parent', 0));
         $menu->published = 1;
         $lookup = '';
     }
     // build the html select list for section
     $rows[] = mosHTML::makeOption('', 'All Sections');
     $query = "SELECT s.id AS `value`, s.id AS `id`, s.title AS `text`" . "\n FROM #__sections AS s" . "\n WHERE s.scope = 'content'" . "\n ORDER BY s.name";
     $database->setQuery($query);
     $rows = array_merge($rows, $database->loadObjectList());
     $section = mosHTML::selectList($rows, 'secid[]', 'class="inputbox" size="10" multiple="multiple"', 'value', 'text', $lookup);
     $lists['sectionid'] = $section;
     // build the html select list for ordering
     $lists['ordering'] = mosAdminMenus::Ordering($menu, $uid);
     // build the html select list for the group access
     $lists['access'] = mosAdminMenus::Access($menu);
     // build the html select list for paraent item
     $lists['parent'] = mosAdminMenus::Parent($menu);
     // build published button option
     $lists['published'] = mosAdminMenus::Published($menu);
     // build the url link output
     $lists['link'] = mosAdminMenus::Link($menu, $uid);
     // get params definitions
     $params =& new mosParameters($menu->params, $mainframe->getPath('menu_xml', $menu->type), 'component');
     /* chipjack: passing $sectCatList (categories) instead of $slist (sections) */
     content_blog_section_html::edit($menu, $lists, $params, $option);
 }
示例#13
0
 /**
  * @return string The html for the limit # input box
  */
 function getLimitBox()
 {
     $limits = array();
     for ($i = 5; $i <= 30; $i += 5) {
         $limits[] = mosHTML::makeOption("{$i}");
     }
     $limits[] = mosHTML::makeOption("50");
     // build the html select list
     $html = mosHTML::selectList($limits, 'limit', 'class="inputbox" size="1" onchange="document.adminForm.submit();"', 'value', 'text', $this->limit);
     $html .= "\n<input type=\"hidden\" name=\"limitstart\" value=\"{$this->limitstart}\" />";
     return $html;
 }
示例#14
0
function newMessage($option, $user, $subject)
{
    global $database, $mainframe, $my, $acl;
    // get available backend user groups
    $gid = $acl->get_group_id('Public Backend', 'ARO');
    $gids = $acl->get_group_children($gid, 'ARO', 'RECURSE');
    $gids = implode(',', $gids);
    // get list of usernames
    $recipients = array(mosHTML::makeOption('0', '- Select User -'));
    $database->setQuery("SELECT id AS value, username AS text FROM #__users" . "\n WHERE gid IN ({$gids})" . "\n ORDER BY name");
    $recipients = array_merge($recipients, $database->loadObjectList());
    $recipientslist = mosHTML::selectList($recipients, 'user_id_to', 'class="inputbox" size="1"', 'value', 'text', $user);
    HTML_messages::newMessage($option, $recipientslist, $subject);
}
示例#15
0
/**
* Compiles a list of trash items
*/
function viewTrash($option)
{
    global $database, $mainframe, $mosConfig_list_limit;
    $catid = $mainframe->getUserStateFromRequest("catid{$option}", 'catid', 'content');
    $limit = intval($mainframe->getUserStateFromRequest("viewlistlimit", 'limit', $mosConfig_list_limit));
    $limitstart = intval($mainframe->getUserStateFromRequest("view{$option}limitstart", 'limitstart', 0));
    require_once $GLOBALS['mosConfig_absolute_path'] . '/administrator/includes/pageNavigation.php';
    if ($catid == "content") {
        // get the total number of content
        $query = "SELECT count(*)" . "\n FROM #__content AS c" . "\n LEFT JOIN #__categories AS cc ON cc.id = c.catid" . "\n LEFT JOIN #__sections AS s ON s.id = cc.section AND s.scope = 'content'" . "\n WHERE c.state = -2";
        $database->setQuery($query);
        $total = $database->loadResult();
        $pageNav = new mosPageNav($total, $limitstart, $limit);
        // Query content items
        $query = "SELECT c.*, g.name AS groupname, cc.name AS catname, s.name AS sectname" . "\n FROM #__content AS c" . "\n LEFT JOIN #__categories AS cc ON cc.id = c.catid" . "\n LEFT JOIN #__sections AS s ON s.id = cc.section AND s.scope='content'" . "\n INNER JOIN #__groups AS g ON g.id = c.access" . "\n LEFT JOIN #__users AS u ON u.id = c.checked_out" . "\n WHERE c.state = -2" . "\n ORDER BY s.name, cc.name, c.title";
        $database->setQuery($query, $pageNav->limitstart, $pageNav->limit);
        $content = $database->loadObjectList();
        $num = $total;
        if ($limit < $total) {
            $num = $limit;
        }
        for ($i = 0; $i < $num - 1; $i++) {
            if ($content[$i]->sectionid == 0 && $content[$i]->catid == 0) {
                $content[$i]->sectname = 'Static Content';
            }
        }
    } else {
        // get the total number of menu
        $query = "SELECT count(*)" . "\n FROM #__menu AS m" . "\n LEFT JOIN #__users AS u ON u.id = m.checked_out" . "\n WHERE m.published = -2";
        $database->setQuery($query);
        $total = $database->loadResult();
        $pageNav = new mosPageNav($total, $limitstart, $limit);
        // Query menu items
        $query = "SELECT m.name AS title, m.menutype AS sectname, m.type AS catname, m.id AS id" . "\n FROM #__menu AS m" . "\n LEFT JOIN #__users AS u ON u.id = m.checked_out" . "\n WHERE m.published = -2" . "\n ORDER BY m.menutype, m.ordering, m.ordering, m.name";
        $database->setQuery($query, $pageNav->limitstart, $pageNav->limit);
        $content = $database->loadObjectList();
    }
    // Build the select list
    $listselect = array();
    $listselect[] = mosHTML::makeOption('content', 'Content Items');
    $listselect[] = mosHTML::makeOption('menu', 'Menu Items');
    $selected = "all";
    $list = mosHTML::selectList($listselect, 'catid', 'class="inputbox" size="1" ' . 'onchange="document.adminForm.submit();"', 'value', 'text', $catid);
    HTML_trash::showList($option, $content, $pageNav, $list, $catid);
}
 function edit($id)
 {
     global $my, $mainframe, $database, $option, $priTask, $subTask;
     global $WBG_CONFIG, $wbGalleryDB_cat;
     $row = new wbGalleryDB_cat($database);
     $row->load($id);
     if (!$row->id) {
         $row->published = 1;
     }
     $lists = array();
     $catTree = $wbGalleryDB_cat->getCategoryTree();
     $tList = array(mosHTML::makeOption('0', 'No Parent...', 'id', 'name'));
     $tList = array_merge($tList, $catTree);
     $lists['parent_id'] = mosHTML::selectList($tList, 'parent_id', '', 'id', 'name', (int) $row->parent_id);
     $lists['published'] = mosHTML::yesnoRadioList('published', '', (int) $row->published);
     $lists['access'] = mosAdminMenus::Access($row);
     wbGallery_cat_html::edit($row, $lists);
 }
示例#17
0
文件: files.php 项目: RangerWalt/ecci
function showFiles()
{
    global $database, $mainframe, $option, $section, $mosConfig_list_limit;
    global $_DOCMAN;
    $limit = $mainframe->getUserStateFromRequest("viewlistlimit", 'limit', $mosConfig_list_limit);
    $limitstart = $mainframe->getUserStateFromRequest("view{$option}{$section}limitstart", 'limitstart', 0);
    $levellimit = $mainframe->getUserStateFromRequest("view{$option}{$section}limit", 'levellimit', 10);
    $filter = $mainframe->getUserStateFromRequest("filterarc{$option}{$section}", 'filter', 0);
    $search = $mainframe->getUserStateFromRequest("search{$option}{$section}", 'search', '');
    // read directory content
    $folder = new DOCMAN_Folder($_DOCMAN->getCfg('dmpath'));
    $files = $folder->getFiles($search);
    for ($i = 0, $n = count($files); $i < $n; $i++) {
        $file =& $files[$i];
        $database->setQuery("SELECT COUNT(dmfilename) FROM #__docman WHERE dmfilename='" . $database->getEscaped($file->name) . "'");
        $result = $database->loadResult();
        if ($database->getErrorNum()) {
            echo $database->stderr();
            return false;
        }
        $file->links = $result;
    }
    if ($filter == 2) {
        $files = array_filter($files, 'filterOrphans');
    }
    if ($filter == 3) {
        $files = array_filter($files, 'filterDocuments');
    }
    $total = count($files);
    require_once $GLOBALS['mosConfig_absolute_path'] . '/administrator/includes/pageNavigation.php';
    $pageNav = new mosPageNav($total, $limitstart, $limit);
    // slice out elements based on limits
    $rows = array_slice($files, $pageNav->limitstart, $pageNav->limit);
    $filters[] = mosHTML::makeOption('0', _DML_SELECT_FILE);
    $filters[] = mosHTML::makeOption('1', _DML_ALLFILES);
    $filters[] = mosHTML::makeOption('2', _DML_ORPHANS);
    $filters[] = mosHTML::makeOption('3', _DML_DOCFILES);
    $lists['filter'] = mosHTML::selectList($filters, 'filter', 'class="inputbox" size="1" onchange="document.adminForm.submit( );"', 'value', 'text', $filter);
    //$search = '';
    HTML_DMFiles::showFiles($rows, $lists, $search, $pageNav);
}
示例#18
0
function FLMS_params_lesson($id, $type_lesson)
{
    global $JLMS_DB;
    $course_id = $id;
    $row = new mos_FLMS_Course_load($JLMS_DB);
    $row->load($id);
    if (!$id) {
        $row->f_id = 0;
        $row->type_lesson = $type_lesson;
        $row->operation = isset($_REQUEST['flms_operation']) && $_REQUEST['flms_operation'] ? $_REQUEST['flms_operation'] : 0;
    } else {
        $row->type_lesson = isset($row->type_lesson) && $row->type_lesson == $type_lesson ? $row->type_lesson : $type_lesson;
    }
    $like_theory = mosGetParam($_REQUEST, 'flms_like_theory', $id ? $row->like_theory : 0);
    $disabled_like_theory = 0;
    if (isset($row->f_id) && $row->f_id) {
        $query = "SELECT count(*) FROM #__lmsb_booking WHERE lesson_id = '" . $row->course_id . "'";
        $JLMS_DB->setQuery($query);
        $disabled_like_theory = $JLMS_DB->loadResult();
    }
    $lists = array();
    $lists['like_theory'] = $like_theory;
    $lists['disabled_like_theory'] = $disabled_like_theory;
    $query = "SELECT id as value, name as text FROM #__lmsf_operations";
    $JLMS_DB->setQuery($query);
    $course_operations = $JLMS_DB->loadObjectList();
    $operation_mass = array();
    $operation_mass[] = mosHTML::makeOption(0, 'Select operation');
    $operation_mass = array_merge($operation_mass, $course_operations);
    $disabled = $row->type_lesson == 1 || $row->type_lesson == 3 ? 'disabled="disabled"' : ($row->type_lesson == 2 && $like_theory ? 'disabled="disabled"' : ($row->type_lesson == 0 ? 'disabled="disabled"' : ''));
    $lists['operation'] = mosHTML::selectList($operation_mass, 'flms_operation', 'class="inputbox" size="1" ' . $disabled, 'value', 'text', $id ? isset($_REQUEST['flms_operation']) ? $_REQUEST['flms_operation'] : $row->operation : $row->operation);
    $query = "SELECT cat_name FROM #__lms_course_cats_config WHERE id = '1'";
    $JLMS_DB->setQuery($query);
    $lists['title_main_category'] = $JLMS_DB->loadResult();
    FLMS_course_html::viewFParametrs($row, $lists);
}
示例#19
0
    static function editBook($option, &$row, &$clist, &$wslist, &$langlist, &$langlistshow, &$rating, &$delete_ebook, &$reviews, &$files)
    {
        global $books, $database, $booklibrary_configuration, $my, $mosConfig_live_site, $mainframe, $doc;
        // for J 1.6
        //    $query = "SELECT lang_code, title FROM #__languages";
        //  $database->setQuery($query);
        // $languages = $database->loadObjectList();
        //my !!!!! -------- langdescription   ------------------------------------------------------------------------------------------
        $lg = JFactory::getLanguage();
        $installed = $lg->getKnownLanguages();
        $languages_row[] = mosHTML::makeOption('*', 'All');
        foreach ($installed as $installang) {
            $langname = $installang['name'];
            $languages_row[] = mosHTML::makeOption($langname, $langname);
        }
        @($langlistshow = mosHTML::selectList($languages_row, 'langshow', 'class="inputbox" size="1"', 'value', 'text', $row->langshow));
        //end of my langdecription ---------  !!!!   ---------------------------------------------------------------------------------------
        //echo "<br /><pre>" . print_r($languages_row, true). "</pre>"; exit;
        //---- end of my langdescrition
        $doc->addStyleSheet($mosConfig_live_site . '/components/com_booklibrary/includes/booklibrary.css');
        $doc->addScript($mosConfig_live_site . '/components/com_booklibrary/includes/functions.js');
        $aa = $row->id ? _BOOKLIBRARY_HEADER_EDIT : _BOOKLIBRARY_HEADER_ADD;
        $html = "<div class='book_manager_caption' ><img src='./components/com_booklibrary/images/cfg.png' alt ='' />" . $aa . "</div>";
        $app = JFactory::getApplication();
        $app->JComponentTitle = $html;
        ?>

        <script language="javascript" type="text/javascript">
            function trim(string){return string.replace(/(^\s+)|(\s+$)/g, "");}
            Joomla.submitbutton = function(task) { // for J 1.6
                var bookid = document.getElementById("bookid").value;// for J 1.6
                var isbn = document.getElementById("isbn").value; // OR document.adminForm.isbn.value
                var catid = document.getElementById("catid").value;// for J 1.6
                var titleid = document.getElementById("titleid").value;
                if (task == 'save') {
                    if (trim(bookid) == '') {
                        alert( "<?php 
        echo _BOOKLIBRARY_ADMIN_INFOTEXT_JS_EDIT_BOOKID_CHECK;
        ?>
" );
                        return;
                    } else if ( trim(isbn) == '') {
                        alert( "<?php 
        echo _BOOKLIBRARY_ADMIN_INFOTEXT_JS_EDIT_ISBN_CHECK;
        ?>
" );
                        return;
                    } else if (catid == '0' || catid == '') {
                        alert( "<?php 
        echo _BOOKLIBRARY_ADMIN_INFOTEXT_JS_EDIT_CATEGORY;
        ?>
");
                        return;
                    } else { submitform( task );}} else {submitform( task );}}
        </script>
        <form action="index.php" method="post" name="adminForm" id="adminForm" enctype="multipart/form-data">
            <table cellpadding="4" cellspacing="1" border="0" width="100%" class="adminform bl_admin_books_book my_table">
                <tr>
                    <td width="15%" align="right">
                        <strong><?php 
        echo _BOOKLIBRARY_LABEL_BOOKID;
        ?>
:</strong>
                    </td>
                    <td width="85%" align="left">
                        <input class="inputbox" type="text" name="bookid" id="bookid" size="20" maxlength="20" value="<?php 
        echo $row->bookid;
        ?>
" />
                    </td>
                </tr>
                <tr>
                    <td width="20%" align="right"><strong><?php 
        echo _BOOKLIBRARY_LABEL_ISBN;
        ?>
:</strong></td>
                    <td align="left">
                        <input class="inputbox" type="text" name="isbn" id="isbn" size="20" maxlength="20" value="<?php 
        echo $row->isbn;
        ?>
" />
                    </td>
                </tr>
                <!-- added dewey decimal code - 20150818 - Ralph deGennaro -->
                <tr>
                    <td width="20%" align="right"><strong><?php 
        echo _BOOKLIBRARY_LABEL_DDCCODE;
        ?>
:</strong></td>
                    <td align="left">
                        <input class="inputbox" type="text" name="ddccode" id="ddccode" size="20" maxlength="20" value="<?php 
        echo $row->ddccode;
        ?>
" />
                    </td>
                </tr>
                <tr>
                    <td valign="top" align="right"><strong><?php 
        echo _BOOKLIBRARY_LABEL_LANGUAGE;
        ?>
:</strong></td>
                    <td align="left"><?php 
        echo $langlist;
        ?>
</td>
                </tr>
                <tr>
                    <td valign="top" align="right"><strong><?php 
        echo _BOOKLIBRARY_LABEL_LANGUAGEDESCRIPTION;
        ?>
:</strong></td>
                    <td align="left"><?php 
        echo $langlistshow;
        ?>
</td>
                </tr>
                <tr>
                    <td valign="top" align="right"><strong><?php 
        echo _BOOKLIBRARY_LABEL_CATEGORY;
        ?>
:</strong></td>
                    <td align="left"><?php 
        echo $clist;
        ?>
</td>
                </tr>
                <tr>
                    <td valign="top" align="right"><strong><?php 
        echo _BOOKLIBRARY_LABEL_FETCH_INFO;
        ?>
:</strong></td>
                    <td align="left">
        <?php 
        echo $wslist;
        ?>
                        &nbsp;&nbsp;&nbsp;<img src="../components/com_booklibrary/images/amazon/com-logo.gif" alt="amazon.com" border="0"/>
                    </td>
                </tr>
                <tr>
                    <td valign="top" align="right"><strong><?php 
        echo _BOOKLIBRARY_LABEL_COMMENT;
        ?>
:</strong></td>
                    <td align="left">
        <?php 
        editorArea('editor1', $row->comment, 'comment', 500, 250, '70', '10');
        ?>
                    </td>
                </tr>
                      <?php 
        if ($booklibrary_configuration['ebooks']['allow']) {
            echo '<tr><td colspan="2"></td></tr>';
            echo "<tr > <td valign='top' align='right'>" . _BOOKLIBRARY_LABEL_EBOOK . ":</td>";
            if (count($files) > 0) {
                for ($i = 0; $i < count($files); $i++) {
                    echo "<tr><td align='right'>" . _BOOKLIBRARY_LABEL_EBOOK_UPLOAD_URL . ($i + 1) . ":";
                    echo "</td><td>";
                    if (isset($files[$i]->location) && substr($files[$i]->location, 0, 4) != "http") {
                        echo "<input type='text' size='60' value='" . $mosConfig_live_site . $files[$i]->location . "' />";
                    } elseif (isset($files[$i]->location) && substr($files[$i]->location, 0, 4) == "http") {
                        echo "<input type='text' size='60' value='" . $files[$i]->location . "' />";
                    }
                    echo "</td></tr>";
                    echo "<tr><td align='right'>" . _BOOKLIBRARY_LABEL_EBOOK_DELETE . ":";
                    echo "</td><td>";
                    echo isset($files[$i]->id) ? "<input type=\"checkbox\" name=\"file_option_del" . $files[$i]->id . "\" value=\"" . $files[$i]->id . "\">" : "";
                    echo "</td></tr>";
                }
            }
            if (count($files) > 0) {
                echo "<td>";
            }
            ?>
                        <td ID="f_items">
                            <input  type="button" name="new_file"
                            value="<?php 
            echo "Add new ebook file";
            ?>
" onClick="new_files()" ID="f_add"/>
                         </td>
        <?php 
            if (count($files) > 0) {
                echo "<td>";
            }
        }
        //---------------------------------Start AJAX load file------------------------------
        ?>
                <script language="javascript" type="text/javascript">
                var request = null;
                var fid=1;
                function createRequest() {
                    if (request != null)
                    return;

                    try {
                        request = new XMLHttpRequest();
                    } catch (trymicrosoft) {
                        try {
                            request = new ActiveXObject("Msxml2.XMLHTTP");
                        } catch (othermicrosoft) {
                            try {
                                request = new ActiveXObject("Microsoft.XMLHTTP");
                            } catch (failed) {
                                request = null;
                            }
                        }
                    }
                    if (request == null)
                        alert(" :-( ___ Error creating request object! ");
                }
                function testInsertFile1(id1,upload){
                    for(var i=1;i<upload_files;i++){
                        if(upload.id != ('new_upload_file'+i) &&
                        document.getElementById('new_upload_file'+i).value==upload.value){
                            return false;
                        }
                    }
                    return true;
                }
                function refreshRandNumber1(id1,upload) {
                    id=id1;
                    if(testInsertFile1(id1,upload)){
                        createRequest();
                        var url = "<?php 
        echo $mosConfig_live_site . '/administrator/components/com_booklibrary/';
        ?>
randNumber.php?file="+upload.value+"&path=<?php 
        echo str_replace("\\", "/", $mosConfig_live_site) . '/components/com_booklibrary/ebooks/';
        ?>
";
                        try{
                        request.onreadystatechange = updateRandNumber1;
                        request.open("GET", url,true);
                        request.send(null);
                        }catch (e )
                        {
                            alert(e);
                        }
                    }
                    else
                    {
                        alert( "You alredy select this file");
                        upload.value="";
                    }
                }
                function updateRandNumber1() {
                    if (request.readyState == 4) {
                        document.getElementById("randNumFile"+fid).innerHTML = request.responseText;
                    }
                }
                </script>
<!-------------------------------- END Ajax load file---------------------------------->
                <script language="javascript" type="text/javascript">
                    var upload_files=0;
                    function new_files(){
                        div=document.getElementById("f_items");
                        button=document.getElementById("f_add");
                        upload_files++;
                        newitem="<table width='50%'><tr><td width='15%'><strong style=\"float:left\">" + "<?php 
        echo _BOOKLIBRARY_LABEL_EBOOK_UPLOAD;
        ?>
" + upload_files + ": </strong></td>";
                        newitem+="<td width='85%'><input style=\"float:left; width:100%\" type=\"file\" onClick=\"document.adminForm.new_upload_file_url"+upload_files+".value ='';\" " +
                        " onChange=\"refreshRandNumber1("+upload_files+
                        ",this);\"  name=\"new_upload_file"+upload_files+"\" "+"id=\"new_upload_file"+upload_files;
                        newitem+="\" value=\"\"size=\"45\">";
                        newitem+="<span id=\"randNumFile"+upload_files+"\" style=\"color:red;\"></span></td></tr></table>";
                        newnode=document.createElement("span");
                        newnode.innerHTML=newitem;
                        div.insertBefore(newnode,button);
                        newitem="<table width='50%'><tr><td width='15%'><strong>" + "<?php 
        echo _BOOKLIBRARY_LABEL_EBOOK_UPLOAD_URL;
        ?>
" + ": </strong></td>";
                        newitem+="<td width='85%'><input style=\"float:left; width:90%\" type=\"text\" name=\"new_upload_file_url"+upload_files+"\" "+"id=\"new_upload_file_url"+upload_files;
                        newitem+="\" value=\"\"size=\"45\"></td></tr></table><br><br />";
                        newnode=document.createElement("span");
                        newnode.innerHTML=newitem;
                        div.insertBefore(newnode,button);
                    }
                </script>

<!--****************************************************end files upload********************************************-->

                <tr>
                    <td colspan="2"><hr size="2" width="100%" /></td>
                </tr>
                <tr>
                    <td valign="top" align="right">&nbsp;</td>
                    <td align="left">
        <?php 
        echo _BOOKLIBRARY_ADMIN_TEXT_WSINFO_TEXT1;
        ?>
                        <strong>
        <?php 
        echo _BOOKLIBRARY_LABEL_FETCH_INFO;
        ?>
                            ->
        <?php 
        echo _BOOKLIBRARY_WS_NO;
        ?>
                        </strong>
                    </td>
                </tr>
                <tr>
                    <td valign="top" align="right">
                        <strong><?php 
        echo _BOOKLIBRARY_LABEL_TITLE;
        ?>
:</strong>
                    </td>
                    <td align="left">
                        <input class="inputbox" id="titleid" type="text" name="title" size="80" value="<?php 
        echo $row->title;
        ?>
" />
                    </td>
                </tr>
                <tr>
                    <td valign="top" align="right">
                        <strong><?php 
        echo _BOOKLIBRARY_LABEL_AUTHORS;
        ?>
:</strong>
                    </td>
                    <td align="left">
                        <input class="inputbox" type="text" name="authors" size="80" value="<?php 
        echo $row->authors;
        ?>
" />
                    </td>
                </tr>
                <tr>
                    <td valign="top" align="right">
                        <strong><?php 
        echo _BOOKLIBRARY_LABEL_MANUFACTURER;
        ?>
:</strong>
                    </td>
                    <td align="left">
                        <input class="inputbox" type="text" name="manufacturer" size="80" value="<?php 
        echo $row->manufacturer;
        ?>
" />
                    </td>
                </tr>
                <tr>
                    <td valign="top" align="right">
                        <strong><?php 
        echo _BOOKLIBRARY_LABEL_PUB_DATE;
        ?>
:</strong>
                    </td>
                    <td align="left">
                        <input class="inputbox" type="text" name="release_Date" size="30" value="<?php 
        echo $row->release_Date;
        ?>
" />
                    </td>
                </tr>
                <tr>
                    <td valign="top" align="right">
                        <strong><?php 
        echo _BOOKLIBRARY_LABEL_PRICE;
        ?>
:</strong>
                    </td>
                    <td align="left">
                        <input class="inputbox" type="text" name="price" size="15" value="<?php 
        echo $row->price;
        ?>
" />
                        <input class="inputbox" type="text" name="priceunit" size="6" value="<?php 
        echo $row->priceunit;
        ?>
" />
                    </td>
                </tr>
                <tr>
                    <td valign="top" align="right">
                        <strong><?php 
        echo _BOOKLIBRARY_LABEL_EDITION;
        ?>
:</strong>
                    </td>
                    <td align="left">
                        <input class="inputbox" type="text" name="edition" size="45" value="<?php 
        echo $row->edition;
        ?>
" />
                    </td>
                </tr>
                <tr>
                    <td valign="top" align="right">
                        <strong><?php 
        echo _BOOKLIBRARY_LABEL_NUMPAGES;
        ?>
:</strong>
                    </td>
                    <td align="left">
                        <input class="inputbox" type="text" name="numberOfPages" size="6" value="<?php 
        echo $row->numberOfPages;
        ?>
" />
                    </td>
                </tr>
                <tr>
                    <td valign="top" align="right">
                        <strong><?php 
        echo _BOOKLIBRARY_LABEL_PICTURE_URL;
        ?>
:</strong>
                    </td>
                    /*
                    <!-- /////////////////////////////Begin AddPatch CODE///////////////////-->
                    */
                    <td align="left">
                        <input class="inputbox" type="text" name="imageURL" size="80" value="<?php 
        echo $row->imageURL;
        ?>
" />
                        <input class="inputbox" type="button" name="default_patch" value="Set Local Cover Path" onClick="build_patch()" />
                        <script type="text/javascript" language="javascript">
                            function build_patch()
                            {
                                var isbn = document.adminForm.isbn.value;var url = 'components/com_booklibrary/isbn_build.php';
        <?php 
        $cover_path = $booklibrary_configuration['fetchImages']['location'];
        ?>
                                    var cover_path = "<?php 
        echo $cover_path;
        ?>
";
                                    if (window.XMLHttpRequest)
                                    {
                                        // Mozilla, Safari,...
                                        http_request = new XMLHttpRequest();
                                        if (http_request.overrideMimeType)
                                        {http_request.overrideMimeType('text/xml');} }
                                    else if (window.ActiveXObject)
                                    {
                                        // IE
                                        try
                                        {http_request = new ActiveXObject("Msxml2.XMLHTTP");}
                                        catch (e)
                                        { try
                                            {http_request = new ActiveXObject("Microsoft.XMLHTTP");}
                                            catch (e) {} }}
                                    if (!http_request)
                                    { alert('Giving up :( Cannot create an XMLHTTP instance');
                                        return false; }
                                    http_request.onreadystatechange = alertContents;
                                    http_request.open("POST", url, true);
                                    http_request.setRequestHeader('Content-Type' , 'application/x-www-form-urlencoded');
                                    http_request.send('isbn='+isbn+'&cover_path='+cover_path); }

                                function alertContents()
                                { if (http_request.readyState == 4)
                                    { if (http_request.status == 200)
                                        { var resp_text = http_request.responseText;if (resp_text == 1)
                                            { alert("<?php 
        echo _BOOKLIBRARY_TOOLBAR_NEW_BOOK_INCORRECT_FOLDER . " " . $cover_path;
        ?>
");}
                                            if (resp_text == false)
                                            { alert(resp_text + "<?php 
        echo _BOOKLIBRARY_TOOLBAR_NEW_BOOK_INCORRECT_FILE;
        ?>
");}
                                            else { document.adminForm.imageURL.value = resp_text;} }
                                        else { alert('There was a problem with the request.');}
                                    } }
                        </script>
                    </td>
                </tr>
                <tr>
                    <td valign="top" align="right">
                        <strong><?php 
        echo _BOOKLIBRARY_LABEL_PICTURE_URL_UPLOAD;
        ?>
:</strong>
                    </td>
                    <td align="left">
                        <input class="inputbox" type="file" name="picture_file" value="" size="50" maxlength="250" />
                        <br /><?php 
        echo _BOOKLIBRARY_LABEL_PICTURE_URL_DESC;
        ?>
                    </td>
                </tr>
                <tr>
                    <td valign="top" align="right">
                        <strong><?php 
        echo _BOOKLIBRARY_LABEL_URL;
        ?>
:</strong>
                    </td>
                    <td align="left">
                        <input class="inputbox" type="text" name="URL" size="80" value="<?php 
        echo $row->URL;
        ?>
" />
                    </td>
                </tr>
                <tr>
                    <td valign="top" align="right">
                        <strong><?php 
        echo _BOOKLIBRARY_LABEL_BOOKOWNER;
        ?>
:</strong>
                    </td>
                    <td align="left">
        <?php 
        echo $row->owner;
        ?>
(<?php 
        echo $row->owneremail;
        ?>
)
                        <input type="hidden" name="owneremail" size="80" value="<?php 
        echo $row->owneremail;
        ?>
" />
                    </td>
                </tr>


                        <?php 
        //***********************************************************************************************************/
        //**********************************   begin change review   ************************************************/
        //***********************************************************************************************************/
        if ($reviews > false) {
            /* show, if review exist */
            ?>
                    <tr>
                        <td colspan="7">
                            <hr width="100%" size="2" align="left"> <h3><?php 
            echo _BOOKLIBRARY_LABEL_REVIEWS;
            ?>
:</h3>
                        </td>
                    </tr>

                    <table class="adminlist admin22">
                        <tr class="row0">
                            <td width="3%" valign="top" align="center"><div>id</div></td>
                            <td width="2%" valign="top" align="center"><div></div></td>
                            <td width="10%" valign="top" align="center">
                                <strong><?php 
            echo _BOOKLIBRARY_LABEL_REVIEW_TITLE;
            ?>
:</strong>
                            </td>
                            <td width="10%" valign="top" align="center">
                                <strong><?php 
            echo _BOOKLIBRARY_LABEL_LEND_USER;
            ?>
:</strong>
                            </td>
                            <td width="65%" valign="top" align="center">
                                <strong><?php 
            echo _BOOKLIBRARY_LABEL_REVIEW_COMMENT;
            ?>
:</strong>
                            </td>
                            <td width="5%" valign="top" align="center">
                                <strong><?php 
            echo _BOOKLIBRARY_LABEL_PUB_DATE;
            ?>
:</strong>
                            </td>
                            <td width="5%" valign="top" align="center">
                                <strong><?php 
            echo _BOOKLIBRARY_LABEL_REVIEW_RATING;
            ?>
:</strong>
                            </td>
                        </tr>

                <?php 
            for ($i = 0, $nn = 1; $i < count($reviews); $i++, $nn++) {
                ?>
                            <tr class="row0">
                                <td valign="top" align="center">
                                    <div><?php 
                echo $nn;
                ?>
</div>
                                </td>
                                <td valign="top" align="center">
                                    <div>
                                <?php 
                echo "<input type='radio' id='cb" . $i . "' name='bid[]' value='" . $row->id . "," . $reviews[$i]->id . "' onclick='Joomla.isChecked(this.checked);' />";
                ?>
                                    </div>
                                </td>
                                <td valign="top" align="center">
                                    <div><?php 
                print_r($reviews[$i]->title);
                ?>
</div>
                                </td>
                                <td valign="top" align="left">
                                    <div><?php 
                print_r($reviews[$i]->name);
                ?>
</div>
                                </td>
                                <td valign="top" align="left">
                                    <div><?php 
                print_r($reviews[$i]->comment);
                ?>
</div>
                                </td>
                                <td valign="top" align="left">
                                    <div><?php 
                print_r($reviews[$i]->date);
                ?>
</div>
                                </td>
                                <td valign="top" align="left">
                                    <div><img src="../components/com_booklibrary/images/rating-<?php 
                echo $reviews[$i]->rating;
                ?>
.gif" alt="<?php 
                echo $reviews[$i]->rating / 2;
                ?>
" border="0" align="right"/>&nbsp;</div>
                                </td>
                            </tr>
            <?php 
            }
            /* end for(...) */
            ?>
                    </table>
                    <?php 
        }
        /* end if(...) */
        ?>
            </table>

            <input type="hidden" name="id" value="<?php 
        echo $row->id;
        ?>
" />
            <input type="hidden" name="option" value="<?php 
        echo $option;
        ?>
" />
            <input type="hidden" name="boxchecked" value="0" />
            <input type="hidden" name="task" value="" />
        </form>
        <?php 
        //***********************************************************************************************************/
        //**********************************   end change review   **************************************************/
        //***********************************************************************************************************/
    }
/**
* Compiles information to add or edit content
* @param database A database connector object
* @param string The name of the category section
* @param integer The unique id of the category to edit (0 if new)
*/
function edit($uid, $option)
{
    global $database, $my, $mainframe;
    global $mosConfig_absolute_path, $mosConfig_live_site, $mosConfig_offset;
    $row = new mosContent($database);
    $row->load((int) $uid);
    $lists = array();
    $nullDate = $database->getNullDate();
    if ($uid) {
        // fail if checked out not by 'me'
        if ($row->isCheckedOut($my->id)) {
            mosErrorAlert("The module " . $row->title . " is currently being edited by another administrator");
        }
        $row->checkout($my->id);
        if (trim($row->images)) {
            $row->images = explode("\n", $row->images);
        } else {
            $row->images = array();
        }
        $row->created = mosFormatDate($row->created, _CURRENT_SERVER_TIME_FORMAT);
        $row->modified = $row->modified == $nullDate ? '' : mosFormatDate($row->modified, _CURRENT_SERVER_TIME_FORMAT);
        $row->publish_up = mosFormatDate($row->publish_up, _CURRENT_SERVER_TIME_FORMAT);
        if (trim($row->publish_down) == $nullDate || trim($row->publish_down) == '' || trim($row->publish_down) == '-') {
            $row->publish_down = 'Never';
        }
        $row->publish_down = mosFormatDate($row->publish_down, _CURRENT_SERVER_TIME_FORMAT);
        $query = "SELECT name" . "\n FROM #__users" . "\n WHERE id = " . (int) $row->created_by;
        $database->setQuery($query);
        $row->creator = $database->loadResult();
        // test to reduce unneeded query
        if ($row->created_by == $row->modified_by) {
            $row->modifier = $row->creator;
        } else {
            $query = "SELECT name" . "\n FROM #__users" . "\n WHERE id = " . (int) $row->modified_by;
            $database->setQuery($query);
            $row->modifier = $database->loadResult();
        }
        // get list of links to this item
        $and = "\n AND componentid = " . (int) $row->id;
        $menus = mosAdminMenus::Links2Menu('content_typed', $and);
    } else {
        // initialise values for a new item
        $row->version = 0;
        $row->state = 1;
        $row->images = array();
        $row->publish_up = date('Y-m-d H:i:s', time() + $mosConfig_offset * 60 * 60);
        $row->publish_down = 'Never';
        $row->sectionid = 0;
        $row->catid = 0;
        $row->creator = '';
        $row->modified = $nullDate;
        $row->modifier = '';
        $row->ordering = 0;
        $menus = array();
    }
    // calls function to read image from directory
    $pathA = $mosConfig_absolute_path . '/images/stories';
    $pathL = $mosConfig_live_site . '/images/stories';
    $images = array();
    $folders = array();
    $folders[] = mosHTML::makeOption('/');
    mosAdminMenus::ReadImages($pathA, '/', $folders, $images);
    // list of folders in images/stories/
    $lists['folders'] = mosAdminMenus::GetImageFolders($folders, $pathL);
    // list of images in specfic folder in images/stories/
    $lists['imagefiles'] = mosAdminMenus::GetImages($images, $pathL);
    // list of saved images
    $lists['imagelist'] = mosAdminMenus::GetSavedImages($row, $pathL);
    // build list of users
    $active = intval($row->created_by) ? intval($row->created_by) : $my->id;
    $lists['created_by'] = mosAdminMenus::UserSelect('created_by', $active);
    // build the html select list for the group access
    $lists['access'] = mosAdminMenus::Access($row);
    // build the html select list for menu selection
    $lists['menuselect'] = mosAdminMenus::MenuSelect();
    // build the select list for the image positions
    $lists['_align'] = mosAdminMenus::Positions('_align');
    // build the select list for the image caption alignment
    $lists['_caption_align'] = mosAdminMenus::Positions('_caption_align');
    // build the select list for the image caption position
    $pos[] = mosHTML::makeOption('bottom', _CMN_BOTTOM);
    $pos[] = mosHTML::makeOption('top', _CMN_TOP);
    $lists['_caption_position'] = mosHTML::selectList($pos, '_caption_position', 'class="inputbox" size="1"', 'value', 'text');
    // get params definitions
    $params = new mosParameters($row->attribs, $mainframe->getPath('com_xml', 'com_typedcontent'), 'component');
    HTML_typedcontent::edit($row, $images, $lists, $params, $option, $menus);
}
示例#21
0
<?php

/**
* @version $Id: content_archive_section.menu.php,v 1.7 2004/09/06 12:24:04 stingrey Exp $
* @package Mambo_4.5.1
* @copyright (C) 2000 - 2004 Miro International Pty Ltd
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
* Mambo is Free Software
*/
/** ensure this file is being included by a parent file */
defined('_VALID_MOS') or die('Direct Access to this location is not allowed.');
//$types[] = mosHTML::makeOption( 'new_item', 'Content Item' );
$types[] = mosHTML::makeOption('content_archive_section', 'Section Archive Blog');
$reqpath = "{$mosConfig_absolute_path}/administrator/components/com_menus/content_archive_section";
require_once "{$reqpath}/content_archive_section.class.php";
require_once "{$reqpath}/content_archive_section.menu.html.php";
switch ($task) {
    case "content_archive_section":
        // this is the new item, ie, the same name as the menu `type`
        content_archive_section_menu::editSection(0, $menutype, $option);
        break;
    case "edit":
        content_archive_section_menu::editSection($cid[0], $menutype, $option);
        break;
    case "save":
        // no special handling
        saveMenu($option);
        break;
    case "publish":
    case "unpublish":
        // no special action
示例#22
0
文件: admin.menus.php 项目: cwcw/cms
/**
* Form for copying item(s) to a specific menu
*/
function copyMenu($option, $cid, $menutype)
{
    global $database, $adminLanguage;
    if (!is_array($cid) || count($cid) < 1) {
        echo "<script> alert('" . $adminLanguage->A_COMP_CATEG_ITEM_MOVE . "'); window.history.go(-1);</script>\n";
        exit;
    }
    ## query to list selected menu items
    $cids = implode(',', $cid);
    $query = "SELECT a.name FROM #__menu AS a WHERE a.id IN ( " . $cids . " )";
    $database->setQuery($query);
    $items = $database->loadObjectList();
    ## query to choose menu
    $query = "SELECT a.params  FROM #__modules AS a WHERE a.module = 'mod_mainmenu' ORDER BY a.title";
    $database->setQuery($query);
    $modules = $database->loadObjectList();
    foreach ($modules as $module) {
        $params = mosParseParams($module->params);
        // adds menutype to array
        $type = trim(@$params->menutype);
        $menu[] = mosHTML::makeOption($type, $type);
    }
    // build the html select list
    $MenuList = mosHTML::selectList($menu, 'menu', 'class="inputbox" size="10"', 'value', 'text', null);
    HTML_menusections::copyMenu($option, $cid, $MenuList, $items, $menutype);
}
示例#23
0
/**
* Compiles information to add or edit a module
* @param string The current GET/POST option
* @param integer The unique id of the record to edit
*/
function editModule($option, $uid, $client)
{
    global $database, $my, $mainframe;
    global $mosConfig_absolute_path;
    $lists = array();
    $row = new mosModule($database);
    // load the row from the db table
    $row->load((int) $uid);
    // fail if checked out not by 'me'
    if ($row->isCheckedOut($my->id)) {
        mosErrorAlert("The module " . $row->title . " is currently being edited by another administrator");
    }
    $row->content = htmlspecialchars($row->content);
    if ($uid) {
        $row->checkout($my->id);
    }
    // if a new record we must still prime the mosModule object with a default
    // position and the order; also add an extra item to the order list to
    // place the 'new' record in last position if desired
    if ($uid == 0) {
        $row->position = 'left';
        $row->showtitle = true;
        //$row->ordering = $l;
        $row->published = 1;
    }
    if ($client == 'admin') {
        $where = "client_id = 1";
        $lists['client_id'] = 1;
        $path = 'mod1_xml';
    } else {
        $where = "client_id = 0";
        $lists['client_id'] = 0;
        $path = 'mod0_xml';
    }
    $query = "SELECT position, ordering, showtitle, title" . "\n FROM #__modules" . "\n WHERE {$where}" . "\n ORDER BY ordering";
    $database->setQuery($query);
    if (!($orders = $database->loadObjectList())) {
        echo $database->stderr();
        return false;
    }
    $query = "SELECT position, description" . "\n FROM #__template_positions" . "\n WHERE position != ''" . "\n ORDER BY position";
    $database->setQuery($query);
    // hard code options for now
    $positions = $database->loadObjectList();
    $orders2 = array();
    $pos = array();
    foreach ($positions as $position) {
        $orders2[$position->position] = array();
        $pos[] = mosHTML::makeOption($position->position, $position->description);
    }
    $l = 0;
    $r = 0;
    for ($i = 0, $n = count($orders); $i < $n; $i++) {
        $ord = 0;
        if (array_key_exists($orders[$i]->position, $orders2)) {
            $ord = count(array_keys($orders2[$orders[$i]->position])) + 1;
        }
        $orders2[$orders[$i]->position][] = mosHTML::makeOption($ord, $ord . '::' . addslashes($orders[$i]->title));
    }
    // build the html select list
    $pos_select = 'onchange="changeDynaList(\'ordering\',orders,document.adminForm.position.options[document.adminForm.position.selectedIndex].value, originalPos, originalOrder)"';
    $active = $row->position ? $row->position : 'left';
    $lists['position'] = mosHTML::selectList($pos, 'position', 'class="inputbox" size="1" ' . $pos_select, 'value', 'text', $active);
    // get selected pages for $lists['selections']
    if ($uid) {
        $query = "SELECT menuid AS value" . "\n FROM #__modules_menu" . "\n WHERE moduleid = " . (int) $row->id;
        $database->setQuery($query);
        $lookup = $database->loadObjectList();
    } else {
        $lookup = array(mosHTML::makeOption(0, 'All'));
    }
    if ($row->access == 99 || $row->client_id == 1 || $lists['client_id']) {
        $lists['access'] = 'Administrator<input type="hidden" name="access" value="99" />';
        $lists['showtitle'] = 'N/A <input type="hidden" name="showtitle" value="1" />';
        $lists['selections'] = 'N/A';
    } else {
        if ($client == 'admin') {
            $lists['access'] = 'N/A';
            $lists['selections'] = 'N/A';
        } else {
            $lists['access'] = mosAdminMenus::Access($row);
            $lists['selections'] = mosAdminMenus::MenuLinks($lookup, 1, 1);
        }
        $lists['showtitle'] = mosHTML::yesnoRadioList('showtitle', 'class="inputbox"', $row->showtitle);
    }
    // build the html select list for published
    $lists['published'] = mosAdminMenus::Published($row);
    $row->description = '';
    // XML library
    require_once $mosConfig_absolute_path . '/includes/domit/xml_domit_lite_include.php';
    // xml file for module
    $xmlfile = $mainframe->getPath($path, $row->module);
    $xmlDoc = new DOMIT_Lite_Document();
    $xmlDoc->resolveErrors(true);
    if ($xmlDoc->loadXML($xmlfile, false, true)) {
        $root =& $xmlDoc->documentElement;
        if ($root->getTagName() == 'mosinstall' && $root->getAttribute('type') == 'module') {
            $element =& $root->getElementsByPath('description', 1);
            $row->description = $element ? trim($element->getText()) : '';
        }
    }
    // get params definitions
    $params = new mosParameters($row->params, $xmlfile, 'module');
    HTML_modules::editModule($row, $orders2, $lists, $params, $option);
}
示例#24
0
 function get_group_children_tree($root_id = null, $root_name = null, $inclusive = true)
 {
     global $database;
     $tree = gacl_api::_getBelow('#__core_acl_aro_groups', 'g1.group_id, g1.name, COUNT(g2.name) AS level', 'g1.name', $root_id, $root_name, $inclusive);
     // first pass get level limits
     $n = count($tree);
     $min = $tree[0]->level;
     $max = $tree[0]->level;
     for ($i = 0; $i < $n; $i++) {
         $min = min($min, $tree[$i]->level);
         $max = max($max, $tree[$i]->level);
     }
     $indents = array();
     foreach (range($min, $max) as $i) {
         $indents[$i] = '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
     }
     // correction for first indent
     $indents[$min] = '';
     $list = array();
     for ($i = $n - 1; $i >= 0; $i--) {
         $shim = '';
         foreach (range($min, $tree[$i]->level) as $j) {
             $shim .= $indents[$j];
         }
         if (@$indents[$tree[$i]->level + 1] == '.&nbsp;') {
             $twist = '&nbsp;';
         } else {
             $twist = "-&nbsp;";
         }
         //$list[$i] = $tree[$i]->level.$shim.$twist.$tree[$i]->name;
         $list[$i] = mosHTML::makeOption($tree[$i]->group_id, $shim . $twist . $tree[$i]->name);
         if ($tree[$i]->level < @$tree[$i - 1]->level) {
             $indents[$tree[$i]->level + 1] = '.&nbsp;';
         }
     }
     ksort($list);
     return $list;
 }
示例#25
0
    function editMailing($mailingEdit, $new, $listId, $forms, $show)
    {
        $lists = array();
        $folders = array();
        if (ACA_CMSTYPE) {
            $my =& JFactory::getUser();
            $folders[] = JHTML::_('select.option', '/');
            $lists['published'] = JHTML::_('select.booleanlist', 'published', 'class="inputbox"', $mailingEdit->published);
            $lists['visible'] = JHTML::_('select.booleanlist', 'visible', 'class="inputbox"', $mailingEdit->visible);
        } else {
            global $my;
            $folders[] = mosHTML::makeOption('/');
            $lists['published'] = mosHTML::yesnoRadioList('published', 'class="inputbox"', $mailingEdit->published);
            $lists['visible'] = mosHTML::yesnoRadioList('visible', 'class="inputbox"', $mailingEdit->visible);
        }
        //endif
        $images = $mailingEdit->images;
        if (!isset($mailingEdit->list_id)) {
            $mailingEdit->list_id = $listId;
        }
        $pathA = ACA_JPATH_ROOT_NO_ADMIN . '/images/stories';
        $pathL = ACA_JPATH_LIVE . '/images/stories';
        $images = array();
        if (ACA_CMSTYPE) {
            mailingsHTML::ReadImages($pathA, '/', $folders, $images);
            if (!isset($images['/'])) {
                $images['/'][] = JHTML::_('select.option', '');
            }
            $javascript = "onchange=\"previewImage( 'imagefiles', 'view_imagefiles', '{$pathL}/' )\"";
            $lists['imagefiles'] = JHTML::_('select.genericlist', $images['/'], 'imagefiles', 'class="inputbox" size="10" multiple="multiple" ' . $javascript, 'value', 'text', null);
            $javascript = "onchange=\"changeDynaList( 'imagefiles', folderimages, document.adminForm.folders.options[document.adminForm.folders.selectedIndex].value, 0, 0);  previewImage( 'imagefiles', 'view_imagefiles', '{$pathL}/' );\"";
            $lists['folders'] = JHTML::_('select.genericlist', $folders, 'folders', 'class="inputbox" size="1" ' . $javascript, 'value', 'text', '/');
            $images2 = array();
            foreach ($mailingEdit->images as $file) {
                $temp = explode('|', $file);
                if (strrchr($temp[0], '/')) {
                    $filename = substr(strrchr($temp[0], '/'), 1);
                } else {
                    $filename = $temp[0];
                }
                $images2[] = JHTML::_('select.option', $file, $filename);
            }
            //$javascript	= "onchange=\"previewImage( 'imagelist', 'view_imagelist', '$path/' ); showImageProps( '$path/' ); \" onfocus=\"previewImage( 'imagelist', 'view_imagelist', '$path/' )\"";
            $javascript = "onchange=\"previewImage( 'imagelist', 'view_imagelist', '{$pathL}/' ); showImageProps( '{$pathL}/' ); \"";
            $lists['imagelist'] = JHTML::_('select.genericlist', $images2, 'imagelist', 'class="inputbox" size="10" ' . $javascript, 'value', 'text');
            $lists['_align'] = JHTML::_('list.positions', '_align');
            $lists['_caption_align'] = JHTML::_('list.positions', '_caption_align');
        } else {
            mosAdminMenus::ReadImages($pathA, '/', $folders, $images);
            $lists['folders'] = mosAdminMenus::GetImageFolders($folders, $pathL);
            $lists['imagefiles'] = mosAdminMenus::GetImages($images, $pathL);
            $lists['imagelist'] = mosAdminMenus::GetSavedImages($mailingEdit, $pathL);
            $lists['_align'] = mosAdminMenus::Positions('_align');
            $lists['_caption_align'] = mosAdminMenus::Positions('_caption_align');
        }
        //endif
        if (ACA_CMSTYPE) {
            // joomla 15
            $pos[] = JHTML::_('select.option', 'bottom', _CMN_BOTTOM);
            $pos[] = JHTML::_('select.option', 'top', _CMN_TOP);
            $lists['_caption_position'] = JHTML::_('select.genericlist', $pos, '_caption_position', 'class="inputbox" size="1"', 'value', 'text');
        } else {
            //joomla 1x
            $pos[] = mosHTML::makeOption('bottom', _CMN_BOTTOM);
            $pos[] = mosHTML::makeOption('top', _CMN_TOP);
            $lists['_caption_position'] = mosHTML::selectList($pos, '_caption_position', 'class="inputbox" size="1"', 'value', 'text');
        }
        //endif
        backHTML::formStart('edit_mailing', $mailingEdit->html, $images);
        echo $forms['main'];
        if ($new and $mailingEdit->list_type == 7) {
            $mailingEdit->issue_nb = 0;
        }
        mailingsHTML::layout($mailingEdit, $lists, $show);
        ?>
		<input type="hidden" name="images" value="" />
		<input type="hidden" name="html" value="<?php 
        echo $mailingEdit->html;
        ?>
" />
		<input type="hidden" name="new_list" value="<?php 
        echo $new;
        ?>
" />
		<input type="hidden" name="listid" value="<?php 
        echo $listId;
        ?>
" />
		<input type="hidden" name="listype" value="<?php 
        echo $mailingEdit->list_type;
        ?>
" />
		<input type="hidden" name="mailingid" value="<?php 
        echo $mailingEdit->id;
        ?>
" />
		<input type="hidden" name="issue_nb" value="<?php 
        echo $mailingEdit->issue_nb;
        ?>
" />
	    <input type="hidden" name="userid" value="<?php 
        echo $my->id;
        ?>
" />
		<?php 
    }
示例#26
0
<?php

/**
* @version $Id: contact_item_link.menu.php,v 1.1 2004/09/20 22:52:48 stingrey Exp $
* @package Mambo_4.5.1
* @copyright (C) 2000 - 2004 Miro International Pty Ltd
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
* Mambo is Free Software
*/
/** ensure this file is being included by a parent file */
defined('_VALID_MOS') or die('Direct Access to this location is not allowed.');
$types[] = mosHTML::makeOption('contact_item_link', 'Link - Contact Item');
$reqpath = $mosConfig_absolute_path . '/administrator/components/com_menus/contact_item_link';
require_once $reqpath . '/contact_item_link.class.php';
require_once $reqpath . '/contact_item_link.menu.html.php';
switch ($task) {
    case 'contact_item_link':
        // this is the new item, ie, the same name as the menu `type`
        contact_item_link_menu::edit(0, $menutype, $option);
        break;
    case 'edit':
        contact_item_link_menu::edit($cid[0], $menutype, $option);
        break;
    case 'save':
        saveMenu($option);
        break;
}
function jlms_booking_edit($cid, $course_id, $option)
{
    global $my, $JLMS_DB, $Itemid, $JLMS_SESSION, $JLMS_CONFIG;
    $JLMS_ACL =& JLMSFactory::getACL();
    if ($course_id && $JLMS_ACL->CheckPermissions('conference', 'manage')) {
        //$usertype = $JLMS_CONFIG->get('current_usertype', 0);
        //if ( $course_id && ($usertype == 1)) {
        $course_params = $JLMS_CONFIG->get('course_params');
        $params_cb = new JLMSParameters($course_params);
        $en_book = $params_cb->get('conf_book', 0);
        if ($cid) {
            $query = "SELECT * FROM #__lms_conference_period WHERE p_id = '" . $cid . "'";
            $JLMS_DB->setQuery($query);
            $row = $JLMS_DB->LoadObjectList();
            $from_hour = date("H", $row[0]->from_time);
            $from_minutes = date("i", $row[0]->from_time);
            $to_hour = date("H", $row[0]->to_time);
            $to_minutes = date("i", $row[0]->to_time);
            $row[0]->cur_date = date("Y-m-d", $row[0]->from_time);
        } else {
            $row[0] = new stdClass();
            $row[0]->p_id = 0;
            $row[0]->public = 0;
            $from_hour = 0;
            $from_minutes = 0;
            $to_hour = 0;
            $to_minutes = 0;
            $row[0]->cur_date = date("Y-m-d");
            $row[0]->p_name = '';
            $row[0]->p_description = '';
            $row[0]->teacher_id = $my->id;
        }
        $lists = array();
        $times = array();
        for ($i = 0; $i < 24; $i++) {
            $times[$i]->value = $i;
            if ($i < 10) {
                $times[$i]->text = '0' . $i;
            } else {
                $times[$i]->text = $i;
            }
        }
        $minutes = array();
        for ($i = 0; $i < 4; $i++) {
            $minutes[$i]->value = $i * 15;
            if ($i == 0) {
                $minutes[$i]->text = '00';
            } else {
                $minutes[$i]->text = $i * 15;
            }
        }
        $lists['from_time'] = mosHTML::selectList($times, 'from_time', 'class="inputbox" size="1" ', 'value', 'text', $from_hour);
        $lists['to_time'] = mosHTML::selectList($times, 'to_time', 'class="inputbox" size="1" ', 'value', 'text', $to_hour);
        $lists['from_minutes'] = mosHTML::selectList($minutes, 'from_min', 'class="inputbox" size="1" ', 'value', 'text', $from_minutes);
        $lists['to_minutes'] = mosHTML::selectList($minutes, 'to_min', 'class="inputbox" size="1" ', 'value', 'text', $to_minutes);
        $query = "SELECT a.id as value, a.name as text FROM #__users as a, #__lms_user_courses as c" . "\n WHERE a.id = c.user_id AND c.course_id = '" . $course_id . "'" . "\n ORDER BY a.name";
        $JLMS_DB->SetQuery($query);
        $teachers = $JLMS_DB->LoadObjectList();
        $teachers_s = array();
        $teachers_s[] = mosHTML::makeOption(0, ' - Select a teacher - ');
        $i = 1;
        foreach ($teachers as $teacher) {
            $teachers_s[] = mosHTML::makeOption($teacher->value, $teacher->text);
            $i++;
        }
        $lists['teacher_id'] = mosHTML::selectList($teachers_s, 'teacher_id', 'class="inputbox" size="1" ', 'value', 'text', $row[0]->teacher_id);
        JLMS_conference_html::jlms_booking_edit($course_id, $option, $row, $lists, $en_book);
    }
}
示例#28
0
 /**
  * Legacy function, deprecated
  *
  * @deprecated	As of version 1.5
  */
 function yesnoSelectList($tag_name, $tag_attribs, $selected, $yes = 'yes', $no = 'no')
 {
     $arr = array(mosHTML::makeOption(0, JText::_($no)), mosHTML::makeOption(1, JText::_($yes)));
     return mosHTML::selectList($arr, $tag_name, $tag_attribs, 'value', 'text', (int) $selected);
 }
示例#29
0
/**
* Compiles information to add or edit a module
* @param string The current GET/POST option
* @param integer The unique id of the record to edit
*/
function editMambot($option, $uid, $client)
{
    global $database, $my, $mainframe, $adminLanguage;
    global $mosConfig_absolute_path;
    $lists = array();
    $row = new mosMambot($database);
    // load the row from the db table
    $row->load($uid);
    // fail if checked out not by 'me'
    if ($row->checked_out && $row->checked_out != $my->id) {
        echo "<script>alert(\"" . $adminLanguage->A_COMP_CONTENT_MODULE . " " . $row->title . " " . $adminLanguage->A_COMP_MAMB_EDIT . "\"); document.location.href='index2.php?option={$option}'</script>\n";
        exit(0);
    }
    if ($uid) {
        $row->checkout($my->id);
    }
    if ($client == 'admin') {
        $where = "client_id='1'";
    } else {
        $where = "client_id='0'";
    }
    if (!$uid) {
        $row->folder = '';
        $row->ordering = 999;
        $row->published = 1;
    }
    // get list of groups
    if ($row->access == 99 || $row->client_id == 1) {
        $lists['access'] = 'Administrator<input type="hidden" name="access" value="99" />';
    } else {
        // build the html select list for the group access
        $lists['access'] = mosAdminMenus::Access($row);
    }
    $lists['published'] = mosHTML::yesnoRadioList('published', 'class="inputbox"', $row->published);
    if ($uid) {
        if ($row->ordering > -10000 && $row->ordering < 10000) {
            // build the html select list for ordering
            $query = "SELECT ordering AS value, name AS text" . "\n FROM #__mambots" . "\n WHERE folder='{$row->folder}'" . "\n AND published > 0" . "\n AND {$where}" . "\n AND ordering > -10000" . "\n AND ordering < 10000" . "\n ORDER BY ordering";
            $order = mosGetOrderingList($query);
            $lists['ordering'] = mosHTML::selectList($order, 'ordering', 'class="inputbox" size="1"', 'value', 'text', intval($row->ordering));
        } else {
            $lists['ordering'] = '<input type="hidden" name="ordering" value="' . $row->ordering . '" />This mambot cannot be reordered';
        }
        $lists['folder'] = '<input type="hidden" name="folder" value="' . $row->folder . '" />' . $row->folder;
    } else {
        $lists['ordering'] = '<input type="hidden" name="ordering" value="' . $row->ordering . '" />New items default to the last place';
        $folders = mosReadDirectory($mosConfig_absolute_path . '/mambots/');
        $folders2 = array();
        foreach ($folders as $folder) {
            if (is_dir($mosConfig_absolute_path . '/mambots/' . $folder)) {
                $folders2[] = mosHTML::makeOption($folder);
            }
        }
        $lists['folder'] = mosHTML::selectList($folders2, 'folder', 'class="inputbox" size="1"', 'value', 'text', null);
    }
    $row->description = '';
    // XML library
    require_once $mosConfig_absolute_path . '/includes/domit/xml_domit_lite_include.php';
    // xml file for module
    $xmlfile = $mosConfig_absolute_path . '/mambots/' . $row->folder . '/' . $row->element . '.xml';
    $xmlDoc =& new DOMIT_Lite_Document();
    $xmlDoc->resolveErrors(true);
    if ($xmlDoc->loadXML($xmlfile, false, true)) {
        $element =& $xmlDoc->documentElement;
        if ($element->getTagName() == 'mosinstall' && $element->getAttribute('type') == 'mambot') {
            $element =& $xmlDoc->getElementsByPath('description', 1);
            $row->description = $element ? trim($element->getText()) : '';
        }
    }
    // get params definitions
    $params =& new mosParameters($row->params, $mainframe->getPath('bot_xml', $row->folder . '/' . $row->element), 'mambot');
    HTML_modules::editMambot($row, $lists, $params, $option);
}
示例#30
0
 /**
  * Writes a yes/no radio list
  * @param string The value of the HTML name attribute
  * @param string Additional HTML attributes for the <select> tag
  * @param mixed The key that is selected
  * @returns string HTML for the radio list
  */
 function yesnoRadioList($tag_name, $tag_attribs, $selected, $yes = false, $no = false)
 {
     $arr = array(mosHTML::makeOption('0', $no ? $no : T_('No')), mosHTML::makeOption('1', $yes ? $yes : T_('Yes')));
     return mosHTML::radioList($arr, $tag_name, $tag_attribs, $selected);
 }