mosAdminMenus Class Reference

List of all members.

Static Public Member Functions

static Ordering (&$row, $id)
static Access (&$row)
static Published (&$row)
static Link (&$row, $id, $link=NULL)
static Target (&$row)
static Category (&$menu, $id, $javascript='')
static Section (&$menu, $id, $all=0)
static Component (&$menu, $id)
static ComponentName (&$menu, $id)
static Images ($name, &$active, $javascript=NULL, $directory=NULL)
static SpecificOrdering (&$row, $id, $query, $neworder=0)
static UserSelect ($name, $active, $nouser=0, $javascript=NULL, $order='name')
static Positions ($name, $active=NULL, $javascript=NULL, $none=1, $center=1, $left=1, $right=1)
static ComponentCategory ($name, $section, $active=NULL, $javascript=NULL, $order='ordering', $size=1, $sel_cat=1)
static SelectSection ($name, $active=NULL, $javascript=NULL, $order='ordering')
static Links2Menu ($type, $_and)
static MenuSelect ($name='menuselect', $javascript=NULL)
static ImageCheckAdmin ($file, $directory, $param=NULL, $param_directory='/administrator/images/', $alt=NULL, $name=NULL, $type=1, $align='middle')
static ReadImages ($imagePath, $folderPath, &$folders, &$images)
static GetImageFolders (&$folders, $path)
static GetImages (&$images, $path)
static GetSavedImages (&$row, $path)
static menutypes ()
static menuItem ($item)

Static Private Member Functions

static mosGetOrderingList ($row, $sql, $chop='30')


Detailed Description

Definition at line 14 of file compatibilityClasses.php.


Member Function Documentation

static mosAdminMenus::Ordering ( &$  row,
id 
) [static]

build the select list for Menu Ordering

Definition at line 18 of file compatibilityClasses.php.

References menutype(), mosGetOrderingList(), mosHTML::selectList(), and T_().

00018                                                   {
00019         if ( $id ) {
00020             $order = mosAdminMenus::mosGetOrderingList( $row, "SELECT ordering AS value, name AS text"
00021             . "\n FROM #__menu"
00022             . "\n WHERE menutype='". $row->menutype ."'"
00023             . "\n AND parent='". $row->parent ."'"
00024             . "\n AND published != '-2'"
00025             . "\n ORDER BY ordering"
00026             );
00027             $ordering = mosHTML::selectList( $order, 'ordering', 'class="inputbox" size="1"', 'value', 'text', intval( $row->ordering ) );
00028         } else {
00029             $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.');
00030         }
00031         return $ordering;
00032     }

static mosAdminMenus::Access ( &$  row  )  [static]

build the select list for access level

Definition at line 37 of file compatibilityClasses.php.

References access, aliroDatabase::getInstance(), and mosHTML::selectList().

00037                                            {
00038         $database = aliroDatabase::getInstance();
00039         $query = 'SELECT id AS value, name AS text FROM #__groups ORDER BY id';
00040         $database->setQuery( $query );
00041         $groups = $database->loadObjectList();
00042         $access = mosHTML::selectList( $groups, 'access', 'class="inputbox" size="3"', 'value', 'text', intval( $row->access ) );
00043         return $access;
00044     }

static mosAdminMenus::Published ( &$  row  )  [static]

build a radio button option for published state

Definition at line 49 of file compatibilityClasses.php.

References published(), and mosHTML::yesnoRadioList().

00049                                               {
00050         $published = mosHTML::yesnoRadioList( 'published', 'class="inputbox"', $row->published );
00051         return $published;
00052     }

static mosAdminMenus::Link ( &$  row,
id,
link = NULL 
) [static]

build the link/url of a menu item

Definition at line 57 of file compatibilityClasses.php.

00057                                                           {
00058         die('mosAdminMenus::Link() has been withdrawn');
00059     }

static mosAdminMenus::Target ( &$  row  )  [static]

build the select list for target window

Definition at line 64 of file compatibilityClasses.php.

References mosHTML::makeOption(), mosHTML::selectList(), and T_().

00064                                            {
00065         $click[] = mosHTML::makeOption( '0',  T_('Parent Window With Browser Navigation'));
00066         $click[] = mosHTML::makeOption( '1',  T_('New Window With Browser Navigation'));
00067         $click[] = mosHTML::makeOption( '2', T_('New Window Without Browser Navigation'));
00068         $target = mosHTML::selectList( $click, 'browserNav', 'class="inputbox" size="4"', 'value', 'text', intval( $row->browserNav ) );
00069         return $target;
00070     }

static mosAdminMenus::Category ( &$  menu,
id,
javascript = '' 
) [static]

build the select list to choose a category

Definition at line 75 of file compatibilityClasses.php.

References componentid(), aliroDatabase::getInstance(), and mosHTML::selectList().

00075                                                                    {
00076         $database = aliroDatabase::getInstance();
00077         $query = "SELECT c.id AS `value`, c.section AS `id`, CONCAT_WS( ' / ', s.title, c.title) AS `text`"
00078         . "\n FROM #__sections AS s"
00079         . "\n INNER JOIN #__categories AS c ON c.section = s.id"
00080         . "\n WHERE s.scope = 'content'"
00081         . "\n ORDER BY s.name,c.name"
00082         ;
00083         $database->setQuery( $query );
00084         $rows = $database->loadObjectList();
00085         $category = '';
00086         if ( $id ) {
00087             foreach ( $rows as $row ) {
00088                 if ( $row->value == $menu->componentid ) {
00089                     $category = $row->text;
00090                 }
00091             }
00092             $category .= '<input type="hidden" name="componentid" value="'. $menu->componentid .'" />';
00093             $category .= '<input type="hidden" name="link" value="'. $menu->link .'" />';
00094         } else {
00095             $category = mosHTML::selectList( $rows, 'componentid', 'class="inputbox" size="10"'. $javascript, 'value', 'text' );
00096             $category .= '<input type="hidden" name="link" value="" />';
00097         }
00098         return $category;
00099     }

static mosAdminMenus::Section ( &$  menu,
id,
all = 0 
) [static]

build the select list to choose a section

Definition at line 104 of file compatibilityClasses.php.

References componentid(), aliroDatabase::getInstance(), mosHTML::makeOption(), mosHTML::selectList(), and T_().

00104                                                           {
00105         $database = aliroDatabase::getInstance();
00106         $query = "SELECT s.id AS `value`, s.id AS `id`, s.title AS `text`"
00107         . "\n FROM #__sections AS s"
00108         . "\n WHERE s.scope = 'content'"
00109         . "\n ORDER BY s.name"
00110         ;
00111         $database->setQuery( $query );
00112         if ( $all ) {
00113             $rows[] = mosHTML::makeOption( 0, T_('- All Sections -') );
00114             $rows = array_merge( $rows, $database->loadObjectList() );
00115         } else {
00116             $rows = $database->loadObjectList();
00117         }
00118 
00119         if ( $id ) {
00120             foreach ( $rows as $row ) {
00121                 if ( $row->value == $menu->componentid ) {
00122                     $section = $row->text;
00123                 }
00124             }
00125             $section .= '<input type="hidden" name="componentid" value="'. $menu->componentid .'" />';
00126             $section .= '<input type="hidden" name="link" value="'. $menu->link .'" />';
00127         } else {
00128             $section = mosHTML::selectList( $rows, 'componentid', 'class="inputbox" size="10"', 'value', 'text' );
00129             $section .= '<input type="hidden" name="link" value="" />';
00130         }
00131         return $section;
00132     }

static mosAdminMenus::Component ( &$  menu,
id 
) [static]

build the select list to choose a component

Definition at line 137 of file compatibilityClasses.php.

00137                                                     {
00138         die ('mosAdminMenu::Component() has been withdrawn');
00139     }

static mosAdminMenus::ComponentName ( &$  menu,
id 
) [static]

build the select list to choose a component

Definition at line 144 of file compatibilityClasses.php.

00144                                                         {
00145         die ('mosAdminMenu::ComponentName() has been withdrawn');
00146     }

static mosAdminMenus::Images ( name,
&$  active,
javascript = NULL,
directory = NULL 
) [static]

build the select list to choose an image

Definition at line 151 of file compatibilityClasses.php.

References criticalInfo::getInstance(), mosHTML::makeOption(), mosHTML::selectList(), and T_().

00151                                                                                         {
00152         if ( !$javascript ) {
00153             $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'}\"";
00154         }
00155         if ( !$directory ) {
00156             $directory = '/images/stories';
00157         }
00158 
00159         $info = criticalInfo::getInstance();
00160         $dir = new aliroDirectory ($info->absolute_path.$directory);
00161         $imageFiles = $dir->listFiles ();
00162         $images = array(  mosHTML::makeOption( '', T_('- Select Image -') ) );
00163         foreach ( $imageFiles as $file ) {
00164             if ( eregi( "bmp|gif|jpg|png", $file ) ) {
00165                 $images[] = mosHTML::makeOption( $file );
00166             }
00167         }
00168         $images = mosHTML::selectList( $images, $name, 'class="inputbox" size="1" '. $javascript, 'value', 'text', $active );
00169 
00170         return $images;
00171     }

static mosAdminMenus::SpecificOrdering ( &$  row,
id,
query,
neworder = 0 
) [static]

build the select list for Ordering of a specified Table

Definition at line 176 of file compatibilityClasses.php.

References mosGetOrderingList(), mosHTML::selectList(), and T_().

00176                                                                                {
00177         if ( $neworder ) {
00178             $text = T_('New items default to the first place. Ordering can be changed after this item is saved.');
00179         } else {
00180             $text = T_('New items default to the last place. Ordering can be changed after this item is saved.');
00181         }
00182 
00183         if ( $id ) {
00184             $order = mosAdminMenus::mosGetOrderingList( $row, $query );
00185             $ordering = mosHTML::selectList( $order, 'ordering', 'class="inputbox" size="1"', 'value', 'text', intval( $row->ordering ) );
00186         } else {
00187             $ordering = '<input type="hidden" name="ordering" value="'. $row->ordering .'" />'. $text;
00188         }
00189         return $ordering;
00190     }

static mosAdminMenus::UserSelect ( name,
active,
nouser = 0,
javascript = NULL,
order = 'name' 
) [static]

Select list of active users

Definition at line 195 of file compatibilityClasses.php.

References aliroDatabase::getInstance(), mosHTML::makeOption(), mosHTML::selectList(), and T_().

00195                                                                                                     {
00196         $database = aliroDatabase::getInstance();
00197         $query = "SELECT id AS value, name AS text"
00198         . "\n FROM #__users"
00199         . "\n WHERE block = '0'"
00200         . "\n ORDER BY ". $order
00201         ;
00202         $database->setQuery( $query );
00203         if ( $nouser ) {
00204             $users[] = mosHTML::makeOption( '0', T_('- No User -') );
00205             $users = array_merge( $users, $database->loadObjectList() );
00206         } else {
00207             $users = $database->loadObjectList();
00208         }
00209 
00210         $users = mosHTML::selectList( $users, $name, 'class="inputbox" size="1" '. $javascript, 'value', 'text', $active );
00211 
00212         return $users;
00213     }

static mosAdminMenus::Positions ( name,
active = NULL,
javascript = NULL,
none = 1,
center = 1,
left = 1,
right = 1 
) [static]

Select list of positions - generally used for location of images

Definition at line 218 of file compatibilityClasses.php.

References mosHTML::makeOption(), mosHTML::selectList(), and T_().

00218                                                                                                                      {
00219         if ( $none ) {
00220             $pos[] = mosHTML::makeOption( '', T_('None') );
00221         }
00222         if ( $center ) {
00223             $pos[] = mosHTML::makeOption( 'center', T_('Center') );
00224         }
00225         if ( $left ) {
00226             $pos[] = mosHTML::makeOption( 'left', T_('Left') );
00227         }
00228         if ( $right ) {
00229             $pos[] = mosHTML::makeOption( 'right', T_('Right') );
00230         }
00231 
00232         $positions = mosHTML::selectList( $pos, $name, 'class="inputbox" size="1"'. $javascript, 'value', 'text', $active );
00233 
00234         return $positions;
00235     }

static mosAdminMenus::ComponentCategory ( name,
section,
active = NULL,
javascript = NULL,
order = 'ordering',
size = 1,
sel_cat = 1 
) [static]

Select list of active categories for components

Definition at line 240 of file compatibilityClasses.php.

References aliroDatabase::getInstance(), mosHTML::makeOption(), mosHTML::selectList(), and T_().

00240                                                                                                                                         {
00241         $database = aliroDatabase::getInstance();
00242         $query = "SELECT id AS value, name AS text"
00243         . "\n FROM #__categories"
00244         . "\n WHERE section = '". $section ."'"
00245         . "\n AND published = '1'"
00246         . "\n ORDER BY ". $order
00247         ;
00248         $database->setQuery( $query );
00249         $cats = $database->loadObjectList();
00250         if ( $sel_cat ) {
00251             $categories[] = mosHTML::makeOption( '0', T_('- All Categories -') );
00252             if ($cats) $categories = array_merge($categories, $cats);
00253         } else {
00254             $categories = $cats ? $cats : array();
00255         }
00256 
00257         if ( count( $categories ) < 1 ) {
00258             mosRedirect( 'index.php?option=com_categories&section='. $section, T_('You must create a category first.') );
00259         }
00260 
00261         $category = mosHTML::selectList( $categories, $name, 'class="inputbox" size="'. $size .'" '. $javascript, 'value', 'text', $active );
00262 
00263         return $category;
00264     }

static mosAdminMenus::SelectSection ( name,
active = NULL,
javascript = NULL,
order = 'ordering' 
) [static]

Select list of active sections

Definition at line 269 of file compatibilityClasses.php.

References aliroDatabase::getInstance(), mosHTML::makeOption(), mosHTML::selectList(), and T_().

00269                                                                                                      {
00270         $database = aliroDatabase::getInstance();
00271         $categories[] = mosHTML::makeOption( '0', T_('- All Sections -') );
00272         $query = "SELECT id AS value, title AS text"
00273         . "\n FROM #__sections"
00274         . "\n WHERE published = '1'"
00275         . "\n ORDER BY ". $order
00276         ;
00277         $results = $database->setQuery( $query );
00278         if ($results) $categories = array_merge ($categories, $results);
00279         return mosHTML::selectList( $categories, $name, 'class="inputbox" size="1" '. $javascript, 'value', 'text', $active );
00280     }

static mosAdminMenus::Links2Menu ( type,
_and 
) [static]

Select list of menu items for a specific menu

Definition at line 285 of file compatibilityClasses.php.

References aliroCoreDatabase::getInstance().

00285                                                       {
00286         $database = aliroCoreDatabase::getInstance();
00287         $query = "SELECT *"
00288         . "\n FROM #__menu"
00289         . "\n WHERE type = '". $type ."'"
00290         . "\n AND published = '1'"
00291         . $_and
00292         ;
00293         $database->setQuery( $query );
00294         $menus = $database->loadObjectList();
00295 
00296         return $menus;
00297     }

static mosAdminMenus::MenuSelect ( name = 'menuselect',
javascript = NULL 
) [static]

Select list of menus

Definition at line 302 of file compatibilityClasses.php.

References aliroCoreDatabase::getInstance(), and mosHTML::selectList().

00302                                                                               {
00303         $database = aliroCoreDatabase::getInstance();
00304         $query = "SELECT params"
00305         . "\n FROM #__modules"
00306         . "\n WHERE module = 'mod_mainmenu'"
00307         ;
00308         $database->setQuery( $query );
00309         $menus = $database->loadObjectList();
00310         $total = count( $menus );
00311         for( $i = 0; $i < $total; $i++ ) {
00312             $paramcode = $menus[$i]->params;
00313             $params = $paramcode ? unserialize ($paramcode) : array();
00314             foreach ($params as &$param) $param = base64_decode($param);
00315             if (isset($params['menutype'])) {
00316                 $menuselect[$i]->value = $params['menutype'];
00317                 $menuselect[$i]->text = $params['menutype'];
00318             }
00319         }
00320         // sort array of objects
00321         if (isset($menuselect)) {
00322             SortArrayObjects( $menuselect, 'text', 1 );
00323             $menus = mosHTML::selectList( $menuselect, $name, 'class="inputbox" size="10" '. $javascript, 'value', 'text' );
00324             return $menus;
00325         }
00326         else return '';
00327     }

static mosAdminMenus::ImageCheckAdmin ( file,
directory,
param = NULL,
param_directory = '/administrator/images/',
alt = NULL,
name = NULL,
type = 1,
align = 'middle' 
) [static]

Checks to see if an image exists in the current templates image directory if it does it loads this image. Otherwise the default image is loaded. Also can be used in conjunction with the menulist param to create the chosen image load the default or use no image

Definition at line 335 of file compatibilityClasses.php.

References $mainframe, aliroCore::get(), and mosMainFrame::getInstance().

Referenced by aliroAdminToolbar::mediaManager().

00335                                                                                                                                                                          {
00336         $mosConfig_absolute_path = aliroCore::get('mosConfig_absolute_path');
00337         $mosConfig_admin_site = aliroCore::get('mosConfig_admin_site');
00338         $mosConfig_live_site = aliroCore::get('mosConfig_live_site');
00339         $mainframe = mosMainFrame::getInstance();
00340         $cur_template = $mainframe->getTemplate();
00341 
00342         if ( $param ) {
00343             $image = $mosConfig_live_site. $param_directory . $param;
00344             if ( $type ) {
00345                 $image = '<img src="'. $image .'" align="'. $align .'" alt="'. $alt .'" name="'. $name .'" border="0" />';
00346             }
00347         } else if ( $param == -1 ) {
00348             $image = '';
00349         } else {
00350             if ( file_exists( $mainframe->getCfg ('admin_absolute_path') .'/templates/'. $cur_template .'/images/'. $file ) ) {
00351                 $image = $mosConfig_admin_site .'/templates/'. $cur_template .'/images/'. $file;
00352             } else {
00353                 $image = $mosConfig_live_site. $directory . $file;
00354             }
00355 
00356             // outputs actual html <img> tag
00357             if ( $type ) {
00358                 $image = '<img src="'. $image .'" alt="'. $alt .'" align="'. $align .'" name="'. $name .'" border="0" />';
00359             }
00360         }
00361 
00362         return $image;
00363     }

static mosAdminMenus::ReadImages ( imagePath,
folderPath,
&$  folders,
&$  images 
) [static]

Internal public static function to recursive scan the media manager directories

Parameters:
string Path to scan
string root path of this folder
array Value array of all existing folders
array Value array of all existing images

Definition at line 372 of file compatibilityClasses.php.

References mosHTML::makeOption().

00372                                                                                       {
00373         $dir = new aliroDirectory ($imagePath);
00374         $imgFiles = $dir->listFiles ();
00375 
00376         foreach ($imgFiles as $file) {
00377             $ff_    = $folderPath . $file .'/';
00378             $ff         = $folderPath . $file;
00379             $i_f    = $imagePath .'/'. $file;
00380 
00381             if ( is_dir( $i_f ) && $file <> 'CVS' ) {
00382                 $folders[] = mosHTML::makeOption( $ff_ );
00383                 mosAdminMenus::ReadImages( $i_f, $ff_, $folders, $images );
00384             } else if ( eregi( "bmp|gif|jpg|png", $file ) && is_file( $i_f ) ) {
00385                 // leading / we don't need
00386                 $imageFile = substr( $ff, 1 );
00387                 $images[$folderPath][] = mosHTML::makeOption( $imageFile, $file );
00388             }
00389         }
00390     }

static mosAdminMenus::GetImageFolders ( &$  folders,
path 
) [static]

Definition at line 392 of file compatibilityClasses.php.

References mosHTML::selectList().

00392                                                                {
00393         $javascript     = "onchange=\"changeDynaList( 'imagefiles', folderimages, document.adminForm.folders.options[document.adminForm.folders.selectedIndex].value, 0, 0);  previewImage( 'imagefiles', 'view_imagefiles', '$path/' );\"";
00394         $getfolders     = mosHTML::selectList( $folders, 'folders', 'class="inputbox" size="1" '. $javascript, 'value', 'text', '/' );
00395         return $getfolders;
00396     }

static mosAdminMenus::GetImages ( &$  images,
path 
) [static]

Definition at line 398 of file compatibilityClasses.php.

References mosHTML::makeOption(), and mosHTML::selectList().

00398                                                         {
00399         if ( !isset($images['/'] ) ) {
00400             $images['/'][] = mosHTML::makeOption( '' );
00401         }
00402 
00403         //$javascript   = "onchange=\"previewImage( 'imagefiles', 'view_imagefiles', '$path/' )\" onfocus=\"previewImage( 'imagefiles', 'view_imagefiles', '$path/' )\"";
00404         $javascript = "onchange=\"previewImage( 'imagefiles', 'view_imagefiles', '$path/' )\"";
00405         $getimages  = mosHTML::selectList( $images['/'], 'imagefiles', 'class="inputbox" size="10" multiple="multiple" '. $javascript , 'value', 'text', null );
00406 
00407         return $getimages;
00408     }

static mosAdminMenus::GetSavedImages ( &$  row,
path 
) [static]

Definition at line 410 of file compatibilityClasses.php.

References mosHTML::makeOption(), and mosHTML::selectList().

00410                                                           {
00411         $images2 = array();
00412         foreach( $row->images as $file ) {
00413             $temp = explode( '|', $file );
00414             if( strrchr($temp[0], '/') ) {
00415                 $filename = substr( strrchr($temp[0], '/' ), 1 );
00416             } else {
00417                 $filename = $temp[0];
00418             }
00419             $images2[] = mosHTML::makeOption( $file, $filename );
00420         }
00421         //$javascript   = "onchange=\"previewImage( 'imagelist', 'view_imagelist', '$path/' ); showImageProps( '$path/' ); \" onfocus=\"previewImage( 'imagelist', 'view_imagelist', '$path/' )\"";
00422         $javascript = "onchange=\"previewImage( 'imagelist', 'view_imagelist', '$path/' ); showImageProps( '$path/' ); \"";
00423         $imagelist  = mosHTML::selectList( $images2, 'imagelist', 'class="inputbox" size="10" '. $javascript, 'value', 'text' );
00424 
00425         return $imagelist;
00426     }

static mosAdminMenus::menutypes (  )  [static]

Definition at line 428 of file compatibilityClasses.php.

00428                                        {
00429         die ('mosAdminMenu::menutypes() has been withdrawn');
00430     }

static mosAdminMenus::menuItem ( item  )  [static]

Definition at line 435 of file compatibilityClasses.php.

00435                                              {
00436         die ('mosAdminMenu::menuItem() has been withdrawn');
00437     }

static mosAdminMenus::mosGetOrderingList ( row,
sql,
chop = '30' 
) [static, private]

Parameters:
string SQL with ordering As value and 'name field' AS text
integer The length of the truncated headline

Definition at line 443 of file compatibilityClasses.php.

References mosHTML::makeOption().

Referenced by Ordering(), and SpecificOrdering().

00443                                                                          {
00444         $order = array();
00445         $database = $row->getDatabase();
00446         $database->setQuery( $sql );
00447         if (!($orders = $database->loadObjectList())) {
00448             if ($database->getErrorNum()) {
00449                 echo $database->stderr();
00450                 return false;
00451             } else {
00452                 $order[] = mosHTML::makeOption( 1, 'first' );
00453                 return $order;
00454             }
00455         }
00456         $order[] = mosHTML::makeOption( 0, '0 first' );
00457         for ($i=0, $n=count( $orders ); $i < $n; $i++) {
00458 
00459             if (strlen($orders[$i]->text) > $chop) {
00460                 $text = substr($orders[$i]->text,0,$chop)."...";
00461             } else {
00462                 $text = $orders[$i]->text;
00463             }
00464 
00465             $order[] = mosHTML::makeOption( $orders[$i]->value, $orders[$i]->value.' ('.$text.')' );
00466         }
00467         $order[] = mosHTML::makeOption( $orders[$i-1]->value+1, ($orders[$i-1]->value+1).' last' );
00468 
00469         return $order;
00470     }


The documentation for this class was generated from the following file:

Generated on Thu Apr 17 13:03:32 2008 for ALIRO by  doxygen 1.5.5