Source for file mosAdminMenus.php

Documentation is available at mosAdminMenus.php

  1. <?php
  2. /**
  3. @package Mambo
  4. @author Mambo Foundation Inc see README.php
  5. @copyright Mambo Foundation Inc.
  6. *  See COPYRIGHT.php for copyright notices and details.
  7. @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see
  8. *  LICENSE.php
  9. *  Mambo is free software; you can redistribute it and/or
  10. *  modify it under the terms of the GNU General Public License
  11. *  as published by the Free Software Foundation; version 2 of the
  12. *  License.
  13. */ 
  14.  
  15. /** ensure this file is being included by a parent file */
  16. defined'_VALID_MOS' or die'Direct Access to this location is not allowed.' );
  17.  
  18. function mosTreeRecurse$id$indent$list&$children$maxlevel=9999$level=0$type=1,$parent='parent'{
  19.     if (@$children[$idAND $level <= $maxlevel{
  20.         $newindent $indent.($type '.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;' '&nbsp;&nbsp;');
  21.         $pre $type '<sup>L</sup>&nbsp;' '- ';
  22.         foreach ($children[$idas $v{
  23.             $id $v->id;
  24.             $list[$id$v;
  25.             $list[$id]->treename $indent.($v->$parent == '' $pre).$v->name;
  26.             $list[$id]->children count@$children[$id);
  27.             $list[$id]->level $level;
  28.             $list mosTreeRecurse$id$newindent$list$children$maxlevel$level+1$type );
  29.         }
  30.     }
  31.     return $list;
  32. }
  33.  
  34. /**
  35. @param string SQL with ordering As value and 'name field' AS text
  36. @param integer The length of the truncated headline
  37. */
  38. function mosGetOrderingList$sql$chop='30' {
  39.     $database mamboDatabase::getInstance();
  40.     $database->setQuery$sql );
  41.     if (!($orders $database->loadObjectList())) {
  42.         if ($database->getErrorNum()) {
  43.             echo $database->stderr();
  44.             return false;
  45.         else {
  46.             $order[mosHTML::makeOption1'first' );
  47.             return $order;
  48.         }
  49.     }
  50.     $order[mosHTML::makeOption0'0 first' );
  51.     foreach ($orders as $ord{
  52.         $text strlen($ord->text$chop substr($ord->text,0,$chop)."..." $ord->text;
  53.         $order[mosHTML::makeOption$ord->value$ord->value.' ('.$text.')' );
  54.     }
  55.     $order[mosHTML::makeOption$ord->value+1($ord->value+1).' last' );
  56.     return $order;
  57. }
  58.  
  59. /**
  60. * Common HTML Output Files
  61. @package Mambo
  62. */
  63. class mosAdminMenus {
  64.     /**
  65.     * build the select list for Menu Ordering
  66.     */
  67.     function Ordering&$row$id {
  68.         global $database;
  69.  
  70.         if $id {
  71.             $order mosGetOrderingList"SELECT ordering AS value, name AS text"
  72.             . "\n FROM #__menu"
  73.             . "\n WHERE menutype='"$row->menutype ."'"
  74.             . "\n AND parent='"$row->parent ."'"
  75.             . "\n AND published != '-2'"
  76.             . "\n ORDER BY ordering"
  77.             );
  78.             $ordering mosHTML::selectList$order'ordering''class="inputbox" size="1"''value''text'intval$row->ordering ) );
  79.         }
  80.         else {
  81.             $ordering '<input type="hidden" name="ordering" value="'$row->ordering .'" />'T_('New items default to the last place. Ordering can be changed after this item is saved.');
  82.         }
  83.         return $ordering;
  84.     }
  85.  
  86.     /**
  87.     * build the select list for access level
  88.     * @param object module object
  89.     * @return mixed a select list
  90.     */
  91.     function Access&$row {
  92.         global $database;
  93.  
  94.         $query 'SELECT id AS value, name AS text FROM #__groups ORDER BY id';
  95.         $database->setQuery$query );
  96.         $groups $database->loadObjectList();
  97.         $access mosHTML::selectList$groups'access''class="inputbox" size="3"''value''text'intval$row->access ) );
  98.         return $access;
  99.     }
  100.  
  101.     /**
  102.     * build the select list for module group access
  103.     */
  104.     function groupAccess&$row {
  105.         global $acl;
  106.         $gtree $acl->get_group_children_treenull'USERS'false );
  107.         $list array();
  108.         $j 0;
  109.         for($i 0$i<count($gtree)$i++{
  110.             $temp explode('-'$gtree[$i]->text);
  111.             $idx (count($temp== 11;
  112.             if ($gtree[$i]->value != 29 && $gtree[$i]->value != 30{
  113.                 $list[$j]->value $gtree[$i]->value;
  114.                 $list[$j]->text trim(str_replace('&nbsp;','',$temp[$idx]));
  115.                 $j++;
  116.             }
  117.         }
  118.         $groups explode(',',$row->groups);
  119.         for($i=0$i count($groups)$i++{
  120.             $group new stdclass;
  121.             $group->value $groups[$i];
  122.             $groups[$i$group;
  123.         }
  124.         $groupSelect mosHTML::selectList$list'groups[]''class="inputbox" multiple="multiple" size="6"''value''text'$groups );
  125.         return $groupSelect;
  126.     }
  127.  
  128.     /**
  129.     * build the select list for parent item
  130.     */
  131.     function Parent&$row {
  132.         global $database;
  133.  
  134.         // get a list of the menu items
  135.         $query "SELECT m.*"
  136.         . "\n FROM #__menu m"
  137.         . "\n WHERE menutype='$row->menutype'"
  138.         . "\n AND published <> -2"
  139.         . "\n ORDER BY ordering"
  140.         ;
  141.         $database->setQuery$query );
  142.         $mitems $database->loadObjectList();
  143.  
  144.         // establish the hierarchy of the menu
  145.         $children array();
  146.         // first pass - collect children
  147.         if (is_array($mitems)) {
  148.             foreach $mitems as $v {
  149.                 $pt $v->parent;
  150.                 $list @$children[$pt$children[$ptarray();
  151.                 array_push$list$v );
  152.                 $children[$pt$list;
  153.             }
  154.         }
  155.         // second pass - get an indent list of the items
  156.         $list mosTreeRecurse0''array()$children99990);
  157.  
  158.         // assemble menu items to the array
  159.         $mitems array();
  160.         $mitems[mosHTML::makeOption'0''Top' );
  161.         $this_treename '';
  162.         foreach $list as $item {
  163.             if $this_treename {
  164.                 if $item->id != $row->id && strpos$item->treename$this_treename === false{
  165.                     $mitems[mosHTML::makeOption$item->id$item->treename );
  166.                 }
  167.             else {
  168.                 if $item->id != $row->id {
  169.                     $mitems[mosHTML::makeOption$item->id$item->treename );
  170.                 else {
  171.                     $this_treename "$item->treename/";
  172.                 }
  173.             }
  174.         }
  175.         $parent mosHTML::selectList$mitems'parent''class="inputbox" size="1"''value''text'$row->parent );
  176.         return $parent;
  177.     }
  178.  
  179.     /**
  180.     * build a radio button option for published state
  181.     */
  182.     function Published&$row {
  183.         $published mosHTML::yesnoRadioList'published''class="inputbox"'$row->published );
  184.         return $published;
  185.     }
  186.  
  187.     /**
  188.     * build the link/url of a menu item
  189.     */
  190.     function Link&$row$id$link=NULL {
  191.         if $id {
  192.             if $link {
  193.                 $link $row->link;
  194.             else {
  195.                 $link $row->link .'&amp;Itemid='$row->id;
  196.             }
  197.         else {
  198.             $link NULL;
  199.         }
  200.         return $link;
  201.     }
  202.  
  203.     /**
  204.     * build the select list for target window
  205.     */
  206.     function Target&$row {
  207.         $click[mosHTML::makeOption'0',  T_('Parent Window With Browser Navigation'));
  208.         $click[mosHTML::makeOption'1',  T_('New Window With Browser Navigation'));
  209.         $click[mosHTML::makeOption'2'T_('New Window Without Browser Navigation'));
  210.         $target mosHTML::selectList$click'browserNav''class="inputbox" size="4"''value''text'intval$row->browserNav ) );
  211.         return $target;
  212.     }
  213.  
  214.     /**
  215.     * build the multiple select list for Menu Links/Pages
  216.     */
  217.     function MenuLinks&$lookup$all=NULL$none=NULL {
  218.         global $database;
  219.  
  220.         // get a list of the menu items
  221.         $database->setQuery"SELECT m.*"
  222.         . "\n FROM #__menu m"
  223.         . "\n WHERE type != 'separator'"
  224.         . "\n AND link NOT LIKE '%tp:/%'"
  225.         . "\n AND published = '1'"
  226.         . "\n ORDER BY menutype, parent, ordering"
  227.         );
  228.         $mitems $database->loadObjectList();
  229.         $mitems_temp $mitems;
  230.  
  231.         // establish the hierarchy of the menu
  232.         $children array();
  233.         // first pass - collect children
  234.         foreach $mitems as $v {
  235.             $id $v->id;
  236.             $pt $v->parent;
  237.             $list @$children[$pt$children[$ptarray();
  238.             array_push$list$v );
  239.             $children[$pt$list;
  240.         }
  241.         // second pass - get an indent list of the items
  242.         $list mosTreeRecurseintval$mitems[0]->parent )''array()$children99990);
  243.  
  244.         // Code that adds menu name to Display of Page(s)
  245.         $text_count "0";
  246.         $mitems_spacer $mitems_temp[0]->menutype;
  247.         foreach ($list as $list_a{
  248.             foreach ($mitems_temp as $mitems_a{
  249.                 if ($mitems_a->id == $list_a->id{
  250.                     // Code that inserts the blank line that seperates different menus
  251.                     if ($mitems_a->menutype <> $mitems_spacer{
  252.                         $list_temp[mosHTML::makeOption-999'----' );
  253.                         $mitems_spacer $mitems_a->menutype;
  254.                     }
  255.                     $text $mitems_a->menutype." | ".$list_a->treename;
  256.                     $list_temp[mosHTML::makeOption$list_a->id$text );
  257.                     if strlen($text$text_count{
  258.                         $text_count strlen($text);
  259.                     }
  260.                 }
  261.             }
  262.         }
  263.         $list $list_temp;
  264.  
  265.         $mitems array();
  266.         if $all {
  267.             // prepare an array with 'all' as the first item
  268.             $mitems[mosHTML::makeOption0T_('All') );
  269.             // adds space, in select box which is not saved
  270.             $mitems[mosHTML::makeOption-999'----' );
  271.         }
  272.         if $none {
  273.             // prepare an array with 'all' as the first item
  274.             $mitems[mosHTML::makeOption-999T_('None') );
  275.             // adds space, in select box which is not saved
  276.             $mitems[mosHTML::makeOption-999'----' );
  277.         }
  278.         // append the rest of the menu items to the array
  279.         foreach ($list as $item{
  280.             $mitems[mosHTML::makeOption$item->value$item->text );
  281.         }
  282.         $pages mosHTML::selectList$mitems'selections[]''class="inputbox" size="26" multiple="multiple"''value''text'$lookup );
  283.         return $pages;
  284.     }
  285.  
  286.  
  287.     /**
  288.     * build the select list to choose a category
  289.     */
  290.     function Category&$menu$id$javascript='' {
  291.         global $database;
  292.  
  293.         $query "SELECT c.id AS `value`, c.section AS `id`, CONCAT_WS( ' / ', s.title, c.title) AS `text`"
  294.         . "\n FROM #__sections AS s"
  295.         . "\n INNER JOIN #__categories AS c ON c.section = s.id"
  296.         . "\n WHERE s.scope = 'content'"
  297.         . "\n ORDER BY s.name,c.name"
  298.         ;
  299.         $database->setQuery$query );
  300.         $rows $database->loadObjectList();
  301.         $category '';
  302.         if $id {
  303.             foreach $rows as $row {
  304.                 if $row->value == $menu->componentid {
  305.                     $category $row->text;
  306.                 }
  307.             }
  308.             $category .= '<input type="hidden" name="componentid" value="'$menu->componentid .'" />';
  309.             $category .= '<input type="hidden" name="link" value="'$menu->link .'" />';
  310.         else {
  311.             $category mosHTML::selectList$rows'componentid''class="inputbox" size="10"'$javascript'value''text' );
  312.             $category .= '<input type="hidden" name="link" value="" />';
  313.         }
  314.         return $category;
  315.     }
  316.  
  317.     /**
  318.     * build the select list to choose a section
  319.     */
  320.     function Section&$menu$id$all={
  321.         global $database;
  322.  
  323.         $query "SELECT s.id AS `value`, s.id AS `id`, s.title AS `text`"
  324.         . "\n FROM #__sections AS s"
  325.         . "\n WHERE s.scope = 'content'"
  326.         . "\n ORDER BY s.name"
  327.         ;
  328.         $database->setQuery$query );
  329.         if $all {
  330.             $rows[mosHTML::makeOption0T_('- All Sections -') );
  331.             $rows array_merge$rows$database->loadObjectList() );
  332.         else {
  333.             $rows $database->loadObjectList();
  334.         }
  335.  
  336.         if $id {
  337.             foreach $rows as $row {
  338.                 if $row->value == $menu->componentid {
  339.                     $section $row->text;
  340.                 }
  341.             }
  342.             $section .= '<input type="hidden" name="componentid" value="'$menu->componentid .'" />';
  343.             $section .= '<input type="hidden" name="link" value="'$menu->link .'" />';
  344.         else {
  345.             $section mosHTML::selectList$rows'componentid''class="inputbox" size="10"''value''text' );
  346.             $section .= '<input type="hidden" name="link" value="" />';
  347.         }
  348.         return $section;
  349.     }
  350.  
  351.     /**
  352.     * build the select list to choose a component
  353.     */
  354.     function Component&$menu$id {
  355.         global $database;
  356.  
  357.         $query "SELECT c.id AS value, c.name AS text, c.link"
  358.         . "\n FROM #__components AS c"
  359.         . "\n WHERE c.link <> ''"
  360.         . "\n ORDER BY c.name"
  361.         ;
  362.         $database->setQuery$query );
  363.         $rows $database->loadObjectList);
  364.         if $id {
  365.             // existing component, just show name
  366.             foreach $rows as $row {
  367.                 if $row->value == $menu->componentid {
  368.                     $component $row->text;
  369.                 }
  370.             }
  371.             $component .= '<input type="hidden" name="componentid" value="'$menu->componentid .'" />';
  372.         else {
  373.             $component mosHTML::selectList$rows'componentid''class="inputbox" size="10"''value''text' );
  374.         }
  375.         return $component;
  376.     }
  377.  
  378.     /**
  379.     * build the select list to choose a component
  380.     */
  381.     function ComponentName&$menu$id {
  382.         global $database;
  383.  
  384.         $query "SELECT c.id AS value, c.name AS text, c.link"
  385.         . "\n FROM #__components AS c"
  386.         . "\n WHERE c.link <> ''"
  387.         . "\n ORDER BY c.name"
  388.         ;
  389.         $database->setQuery$query );
  390.         $rows $database->loadObjectList);
  391.  
  392.         $component 'Component';
  393.         foreach $rows as $row {
  394.             if $row->value == $menu->componentid {
  395.                 $component $row->text;
  396.             }
  397.         }
  398.  
  399.         return $component;
  400.     }
  401.  
  402.     /**
  403.     * build the select list to choose an image
  404.     */
  405.     function Images$name&$active$javascript=NULL$directory=NULL {
  406.         global $mosConfig_absolute_path;
  407.  
  408.         if !$javascript {
  409.             $javascript "onchange=\"javascript:if (document.forms[0].image.options[selectedIndex].value!='') {document.imagelib.src='../images/stories/' + document.forms[0].image.options[selectedIndex].value} else {document.imagelib.src='../images/blank.png'}\"";
  410.         }
  411.         if !$directory {
  412.             $directory '/images/stories';
  413.         }
  414.  
  415.         $imageFiles mosReadDirectory$mosConfig_absolute_path $directory );
  416.         $images array(  mosHTML::makeOption''T_('- Select Image -') ) );
  417.         foreach $imageFiles as $file {
  418.             if eregi"bmp|gif|jpg|png"$file ) ) {
  419.                 $images[mosHTML::makeOption$file );
  420.             }
  421.         }
  422.         $images mosHTML::selectList$images$name'class="inputbox" size="1" '$javascript'value''text'$active );
  423.  
  424.         return $images;
  425.     }
  426.  
  427.     /**
  428.     * build the select list for Ordering of a specified Table
  429.     */
  430.     function SpecificOrdering&$row$id$query$neworder={
  431.         global $database;
  432.  
  433.         if $neworder {
  434.             $text T_('New items default to the first place. Ordering can be changed after this item is saved.');
  435.         else {
  436.             $text T_('New items default to the last place. Ordering can be changed after this item is saved.');
  437.         }
  438.  
  439.         if $id {
  440.             $order mosGetOrderingList$query );
  441.             $ordering mosHTML::selectList$order'ordering''class="inputbox" size="1"''value''text'intval$row->ordering ) );
  442.         else {
  443.             $ordering '<input type="hidden" name="ordering" value="'$row->ordering .'" />'$text;
  444.         }
  445.         return $ordering;
  446.     }
  447.  
  448.     /**
  449.     * Select list of active users
  450.     */
  451.     function UserSelect$name$active$nouser=0$javascript=NULL$order='name' {
  452.         global $database$my;
  453.  
  454.         $query "SELECT id AS value, CONCAT(name,' (',username,')') AS text"
  455.         . "\n FROM #__users"
  456.         . "\n WHERE block = '0'"
  457.         . "\n ORDER BY "$order
  458.         ;
  459.         $database->setQuery$query );
  460.         if $nouser {
  461.             $users[mosHTML::makeOption'0'T_('- No User -') );
  462.             $users array_merge$users$database->loadObjectList() );
  463.         else {
  464.             $users $database->loadObjectList();
  465.         }
  466.  
  467.         $users mosHTML::selectList$users$name'class="inputbox" size="1" '$javascript'value''text'$active );
  468.  
  469.         return $users;
  470.     }
  471.  
  472.     /**
  473.     * Select list of positions - generally used for location of images
  474.     */
  475.     function Positions$name$active=NULL$javascript=NULL$none=1$center=1$left=1$right={
  476.         if $none {
  477.             $pos[mosHTML::makeOption''T_('None') );
  478.         }
  479.         if $center {
  480.             $pos[mosHTML::makeOption'center'T_('Center') );
  481.         }
  482.         if $left {
  483.             $pos[mosHTML::makeOption'left'T_('Left') );
  484.         }
  485.         if $right {
  486.             $pos[mosHTML::makeOption'right'T_('Right') );
  487.         }
  488.  
  489.         $positions mosHTML::selectList$pos$name'class="inputbox" size="1"'$javascript'value''text'$active );
  490.  
  491.         return $positions;
  492.     }
  493.  
  494.     /**
  495.     * Select list of active categories for components
  496.     */
  497.     function ComponentCategory$name$section$active=NULL$javascript=NULL$order='ordering'$size=1$sel_cat={
  498.         global $database;
  499.  
  500.         $query "SELECT id AS value, name AS text"
  501.         . "\n FROM #__categories"
  502.         . "\n WHERE section = '"$section ."'"
  503.         . "\n AND published = '1'"
  504.         . "\n ORDER BY "$order
  505.         ;
  506.         $database->setQuery$query );
  507.         $categories $database->loadObjectList();
  508.         if (!$categories$categories array();
  509.         if $sel_cat array_unshift($categoriesmosHTML::makeOption('0'T_('- All Categories -')));
  510.         if count$categories mosRedirect'index2.php?option=com_categories&section='$sectionT_('You must create a category first.') );
  511.         $categorylist mosHTML::selectList$categories$name'class="inputbox" size="'$size .'" '$javascript'value''text'$active );
  512.         return $categorylist;
  513.     }
  514.  
  515.     /**
  516.     * Select list of active sections
  517.     */
  518.     function SelectSection$name$active=NULL$javascript=NULL$order='ordering' {
  519.         global $database;
  520.  
  521.         $categories[mosHTML::makeOption'0'T_('- All Sections -') );
  522.         $query "SELECT id AS value, title AS text"
  523.         . "\n FROM #__sections"
  524.         . "\n WHERE published = '1'"
  525.         . "\n ORDER BY "$order
  526.         ;
  527.         $database->setQuery$query );
  528.         if (is_array($database->loadObjectList())) {
  529.           $sections array_merge$categories$database->loadObjectList() );
  530.         }
  531.         $category mosHTML::selectList$sections$name'class="inputbox" size="1" '$javascript'value''text'$active );
  532.  
  533.         return $category;
  534.     }
  535.  
  536.     /**
  537.     * Select list of menu items for a specific menu
  538.     */
  539.     function Links2Menu$type$_and {
  540.         global $database;
  541.  
  542.         $query "SELECT *"
  543.         . "\n FROM #__menu"
  544.         . "\n WHERE type = '"$type ."'"
  545.         . "\n AND published = '1'"
  546.         . $_and
  547.         ;
  548.         $database->setQuery$query );
  549.         $menus $database->loadObjectList();
  550.  
  551.         return $menus;
  552.     }
  553.  
  554.     /**
  555.     * Select list of menus
  556.     */
  557.     function MenuSelect$name='menuselect'$javascript=NULL {
  558.         global $database;
  559.  
  560.         $query "SELECT params"
  561.         . "\n FROM #__modules"
  562.         . "\n WHERE module = 'mod_mainmenu'"
  563.         ;
  564.         $database->setQuery$query );
  565.         $menus $database->loadObjectList();
  566.         $total count$menus );
  567.         for$i 0$i $total$i++ {
  568.             $params mosParseParams$menus[$i]->params );
  569.             $menuselect[$i]->value     $params->menutype;
  570.             $menuselect[$i]->text     $params->menutype;
  571.         }
  572.         // sort array of objects
  573.         SortArrayObjects$menuselect'text');
  574.  
  575.         $menus mosHTML::selectList$menuselect$name'class="inputbox" size="10" '$javascript'value''text' );
  576.  
  577.         return $menus;
  578.     }
  579.  
  580.     /**
  581.     * Checks to see if an image exists in the current templates image directory
  582.      * if it does it loads this image.  Otherwise the default image is loaded.
  583.     * Also can be used in conjunction with the menulist param to create the chosen image
  584.     * load the default or use no image
  585.     */
  586.     function ImageCheckAdmin$file$directory='/administrator/images/'$param=NULL$param_directory='/administrator/images/'$alt=NULL$name=NULL$type=1$align='middle' {
  587.         $mosConfig_live_site mamboCore::get('mosConfig_live_site');
  588.         $mainframe mosMainFrame::getInstance();
  589.         $cur_template $mainframe->getTemplate();
  590.         if ($param$image $mosConfig_live_site$param_directory $param;
  591.         else {
  592.             if file_exists(mamboCore::get('mosConfig_absolute_path').'/administrator/templates/'$cur_template .'/images/'$file ) ) {
  593.                 $image $mosConfig_live_site .'/administrator/templates/'$cur_template .'/images/'$file;
  594.             }
  595.             else $image $mosConfig_live_site$directory $file;
  596.         }
  597.         // outputs actual html <img> tag
  598.         if $type $image '<img src="'$image .'" alt="'$alt .'" align="'$align .'" name="'$name .'" border="0" />';
  599.         return $image;
  600.     }
  601.  
  602.     /**
  603.     * Internal function to recursive scan the media manager directories
  604.     * @param string Path to scan
  605.     * @param string root path of this folder
  606.     * @param array  Value array of all existing folders
  607.     * @param array  Value array of all existing images
  608.     */
  609.     function ReadImages$imagePath$folderPath&$folders&$images {
  610.         $imgDir =new mosDirectory($imagePath);
  611.         $imgFiles =$imgDir->listFiles ('.''both');
  612.  
  613.         foreach ($imgFiles as $file{
  614.             $ff_ $folderPath $file .'/';
  615.             $ff $folderPath $file;
  616.             $i_f $imagePath .'/'$file;
  617.  
  618.             if is_dir$i_f AND $file <> 'CVS' {
  619.                 $folders[mosHTML::makeOption$ff_ );
  620.                 mosAdminMenus::ReadImages$i_f$ff_$folders$images );
  621.             else if eregi"bmp|gif|jpg|png"$file AND is_file$i_f ) ) {
  622.                 // leading / we don't need
  623.                 $imageFile substr$ff);
  624.                 $images[$folderPath][mosHTML::makeOption$imageFile$file );
  625.             }
  626.         }
  627.     }
  628.  
  629.     function GetImageFolders&$folders$path {
  630.         $javascript     "onchange=\"changeDynaList( 'imagefiles', folderimages, document.adminForm.folders.options[document.adminForm.folders.selectedIndex].value, 0, 0);  previewImage( 'imagefiles', 'view_imagefiles', '$path/' );\"";
  631.         $getfolders     mosHTML::selectList$folders'folders''class="inputbox" size="1" '$javascript'value''text''/' );
  632.         return $getfolders;
  633.     }
  634.  
  635.     function GetImages&$images$path {
  636.         if !isset($images['/') ) $images['/'][mosHTML::makeOption'' );
  637.         //$javascript    = "onchange=\"previewImage( 'imagefiles', 'view_imagefiles', '$path/' )\" onfocus=\"previewImage( 'imagefiles', 'view_imagefiles', '$path/' )\"";
  638.         $javascript    "onchange=\"previewImage( 'imagefiles', 'view_imagefiles', '$path/' )\"";
  639.         $getimages    mosHTML::selectList$images['/']'imagefiles''class="inputbox" size="10" multiple="multiple" '$javascript 'value''text'null );
  640.  
  641.         return $getimages;
  642.     }
  643.  
  644.     function GetSavedImages&$row$path {
  645.         $images2 array();
  646.         foreach$row->images as $file {
  647.             $temp explode'|'$file );
  648.             $filename strrchr($temp[0]'/'substrstrrchr($temp[0]'/' )$temp[0];
  649.             $images2[mosHTML::makeOption$file$filename );
  650.         }
  651.         //$javascript    = "onchange=\"previewImage( 'imagelist', 'view_imagelist', '$path/' ); showImageProps( '$path/' ); \" onfocus=\"previewImage( 'imagelist', 'view_imagelist', '$path/' )\"";
  652.         $javascript    "onchange=\"previewImage( 'imagelist', 'view_imagelist', '$path/' ); showImageProps( '$path/' ); \"";
  653.         $imagelist     mosHTML::selectList$images2'imagelist''class="inputbox" size="10" '$javascript'value''text' );
  654.  
  655.         return $imagelist;
  656.     }
  657.  
  658.     function menutypes({
  659.         $modulehandler =mosModuleHandler::getInstance();
  660.         $modMenus =$modulehandler->getByName('mod_mainmenu'falsetrue);
  661.  
  662.         $menuhandler =mosMenuHandler::getInstance();
  663.         $mtypes =$menuhandler->getMenuTypes();
  664.         $menuTypes array();
  665.         foreach ($mtypes as $type=>$count$menuTypes[$type;
  666.         foreach ($modMenus as $modMenu{
  667.             mosMakeHtmlSafe($modMenu;
  668.             $modParams     mosParseParams$modMenu->params );
  669.             $menuType     @$modParams->menutype $modParams->menutype 'منوی اصلی';
  670.             if (!in_array($menuType$menuTypes)) $menuTypes[$menuType;
  671.         }
  672.  
  673.         // sorts menutypes
  674.         asort$menuTypes );
  675.  
  676.         return $menuTypes;
  677.     }
  678.  
  679.     /*
  680.     * loads files required for menu items
  681.     */
  682.     function menuItem$item {
  683.         global $mosConfig_absolute_path;
  684.  
  685.         $path $mosConfig_absolute_path .'/administrator/components/com_menus/'$item .'/';
  686.         include_once$path $item .'.class.php' );
  687.         include_once$path $item .'.menu.html.php' );
  688.     }
  689. }
  690.  
  691. ?>

Documentation generated on Mon, 05 May 2008 16:21:27 +0400 by phpDocumentor 1.4.0