aliroFolder Class Reference

Inheritance diagram for aliroFolder:

aliroDatabaseRow aliroDBGeneralRow

List of all members.

Public Member Functions

 load ($key=null)
 trash ()
 isTrash ()
 addChild ($id)
 deleteAll ()
 setMetaData ()
 isCategory ()
 getCategoryName ($showself=false)
 getCategory ()
 getFamilyNames ($include=false)
 addChildren (&$descendants, $published=true, $search='', $recurse=false)
 getChildren ($published=true, $search='')
 getDescendants ($search='')
 getParent ()
 getSelectList ($type, $parm, $published, $notThis=0)
 addSelectList ($prefix, &$selector, $notThis, $published)
 getURL ()
 setPathway ()
 togglePublished ($idlist, $value)
 imageURL ($imageName, $width=32, $height=32)

Static Public Member Functions

static getIcons ()

Protected Attributes

 $DBclass = 'aliroDatabase'
 $tableName = '#__folders'
 $rowKey = 'id'
 $loaded = 0
 $children = array()
 $isTrash = false


Detailed Description

Folder component - problem domain classes /* Author: Martin Brampton /* Date: December 2006 /* Copyright (c) Martin Brampton 2006 /*

Definition at line 9 of file aliroFolder.php.


Member Function Documentation

aliroFolder::load ( key = null  ) 

Reimplemented from aliroDBGeneralRow.

Definition at line 17 of file aliroFolder.php.

References aliroDatabase::getInstance().

00017                                      {
00018         $database = aliroDatabase::getInstance();
00019         if ($this->loaded == 0 AND $this->id) {
00020             $database->setQuery("SELECT * FROM #__folders WHERE id=$this->id");
00021             $database->loadObject($this);
00022             $this->loaded = 1;
00023         }
00024     }

aliroFolder::trash (  ) 

Definition at line 26 of file aliroFolder.php.

References isTrash().

Referenced by deleteAll().

00026                              {
00027         $this->isTrash = true;
00028     }

aliroFolder::isTrash (  ) 

Definition at line 30 of file aliroFolder.php.

Referenced by trash().

00030                                {
00031         return $this->isTrash;
00032     }

aliroFolder::addChild ( id  ) 

Definition at line 34 of file aliroFolder.php.

00034                                    {
00035         $this->children[] = $id;
00036     }

aliroFolder::deleteAll (  ) 

Definition at line 38 of file aliroFolder.php.

References getChildren(), and trash().

00038                                  {
00039         $folders = $this->getChildren(false);
00040         foreach ($folders as $folder) $folder->deleteAll ();
00041 //      Need to delete things that are registered with this
00042         $this->trash();
00043     }

aliroFolder::setMetaData (  ) 

Definition at line 45 of file aliroFolder.php.

References $mainframe, mosMainFrame::getInstance(), and name.

00045                                    {
00046         $mainframe = mosMainFrame::getInstance();
00047         $mainframe->prependMetaTag('description', strip_tags($this->name));
00048         if ($this->keywords) $mainframe->prependMetaTag('keywords', $this->keywords);
00049         else $mainframe->prependMetaTag('keywords', $this->name);
00050     }

aliroFolder::isCategory (  ) 

Definition at line 52 of file aliroFolder.php.

00052                                   {
00053         if ($this->parentid == 0) return true;
00054         else return false;
00055     }

aliroFolder::getCategoryName ( showself = false  ) 

Definition at line 57 of file aliroFolder.php.

References getCategory().

00057                                                       {
00058         $category = $this->getCategory();
00059         if ($this->parentid OR $showself) return $category->name;
00060         return '*';
00061     }

aliroFolder::getCategory (  ) 

Definition at line 63 of file aliroFolder.php.

Referenced by getCategoryName().

00063                                    {
00064         $folder = $this;
00065         while ($folder->parentid) $folder = $folder->getParent();
00066         return $folder;
00067     }

aliroFolder::getFamilyNames ( include = false  ) 

Definition at line 69 of file aliroFolder.php.

00069                                                     {
00070         $names = $include ? '/'.$this->name : '';
00071         $generation = 1;
00072         $ancestor = $this;
00073         while ($ancestor->parentid AND $generation < 3) {
00074             $ancestor = $ancestor->getParent();
00075             $generation++;
00076             $names = '/'.$ancestor->name.$names;
00077         }
00078         if ($ancestor->parentid) $names = '..'.$names;
00079         if ($names) return $names;
00080         return '-';
00081     }

aliroFolder::addChildren ( &$  descendants,
published = true,
search = '',
recurse = false 
)

Definition at line 83 of file aliroFolder.php.

References $children, aliroFolderHandler::getInstance(), name, and published().

Referenced by getChildren(), and getDescendants().

00083                                                                                              {
00084         $children = array();
00085         $handler = aliroFolderHandler::getInstance();
00086         foreach ($this->children as $i) {
00087             $folder = $handler->getBasicFolder($i);
00088             if ($published AND $folder->published == 0) continue;
00089             if ($search AND strpos(strtolower($folder->name), strtolower($search)) === false) continue;
00090             $children[] = $folder;
00091             $descendants[] = $folder;
00092         }
00093         if ($recurse) foreach ($children as $child) $child->addChildren ($descendants, $published, $search, $recurse);
00094         return $children;
00095     }

aliroFolder::getChildren ( published = true,
search = '' 
)

Definition at line 97 of file aliroFolder.php.

References $children, and addChildren().

Referenced by addSelectList(), and deleteAll().

00097                                                               {
00098         $children = array();
00099         $this->addChildren($children, $published, $search);
00100         return $children;
00101     }

aliroFolder::getDescendants ( search = ''  ) 

Definition at line 103 of file aliroFolder.php.

References addChildren().

00103                                                 {
00104         $descendants = array();
00105         $this->addChildren ($descendants, false, $search, true);
00106         return $descendants;
00107     }

aliroFolder::getParent (  ) 

Definition at line 109 of file aliroFolder.php.

References aliroFolderHandler::getInstance().

00109                                  {
00110         $handler = aliroFolderHandler::getInstance();
00111         $parent = $handler->getBasicFolder($this->parentid);
00112         return $parent;
00113     }

aliroFolder::getSelectList ( type,
parm,
published,
notThis = 0 
)

Definition at line 115 of file aliroFolder.php.

References aliroFolderHandler::getInstance(), aliroHTML::getInstance(), and T_().

00115                                                                          {
00116         $alirohtml = aliroHTML::getInstance();
00117         $selector[] = $alirohtml->makeOption(0,T_('No parent'));
00118         $handler = aliroFolderHandler::getInstance();
00119         foreach ($handler->getCategories() as $category) $category->addSelectList('',$selector,$notThis,$published);
00120         return $alirohtml->selectList( $selector, $type, $parm, 'value', 'text', $this->id );
00121     }

aliroFolder::addSelectList ( prefix,
&$  selector,
notThis,
published 
)

Definition at line 123 of file aliroFolder.php.

References getChildren(), aliroHTML::getInstance(), and name.

00123                                                                               {
00124         if (($notThis == 0) OR ($this->id != $notThis)) $selector[] = aliroHTML::getInstance()->makeOption($this->id, $prefix.htmlspecialchars($this->name));
00125         foreach ($this->getChildren($published) as $folder) $folder->addSelectList($prefix.$this->name.'/',$selector,$notThis,$published);
00126     }

aliroFolder::getURL (  ) 

Definition at line 128 of file aliroFolder.php.

00128                        {
00129     }

aliroFolder::setPathway (  ) 

Definition at line 131 of file aliroFolder.php.

00131                            {
00132     }

static aliroFolder::getIcons (  )  [static]

Definition at line 134 of file aliroFolder.php.

References aliroCore::get().

00134                                        {
00135         $iconList = '';
00136         $live_site = aliroCore::get('mosConfig_live_site');
00137         $iconDir = new aliroDirectory (aliroCore::get('mosConfig_admin_absolute_path').'/components/com_folders/images/folder_icons');
00138         $files = $iconDir->listAll();
00139         $ss = 0;
00140         foreach ($files as $file) {
00141             $iconList.="\n<a href=\"JavaScript:paste_strinL('{$file}')\" onmouseover=\"window.status='{$file}'; return true\"><img src=\"{$live_site}/administrator/components/com_folders/images/folder_icons/{$file}\" width=\"32\" height=\"32\" border=\"0\" alt=\"{$file}\" /></a>&nbsp;&nbsp;";
00142             $ss++;
00143             if ($ss % 10 == 0) $iconList.="<br/>\n";
00144         }
00145         return $iconList;
00146     }

aliroFolder::togglePublished ( idlist,
value 
)

Definition at line 149 of file aliroFolder.php.

00149                                                       {
00150         $cids = implode( ',', $idlist );
00151         $sql = "UPDATE #__folders SET published=$value". "\nWHERE id IN ($cids)";
00152         remositoryRepository::doSQL ($sql);
00153     }

aliroFolder::imageURL ( imageName,
width = 32,
height = 32 
)

Definition at line 155 of file aliroFolder.php.

References aliroCore::get().

00155                                                                 {
00156         $live_site = aliroCore::get('mosConfig_live_site');
00157         $element = '<img src="';
00158         $element .= $live_site.'/administrator/components/com_folders/images/'.$imageName;
00159         $element .= '" width="';
00160         $element .= $width;
00161         $element .= '" height="';
00162         $element .= $height;
00163         $element .= '" border="0" align="middle" alt="';
00164         $element .= $imageName;
00165         $element .= '"/>';
00166         return $element;
00167     }


Member Data Documentation

aliroFolder::$DBclass = 'aliroDatabase' [protected]

Definition at line 10 of file aliroFolder.php.

aliroFolder::$tableName = '#__folders' [protected]

Definition at line 11 of file aliroFolder.php.

aliroFolder::$rowKey = 'id' [protected]

Definition at line 12 of file aliroFolder.php.

aliroFolder::$loaded = 0 [protected]

Definition at line 13 of file aliroFolder.php.

aliroFolder::$children = array() [protected]

Definition at line 14 of file aliroFolder.php.

Referenced by addChildren(), and getChildren().

aliroFolder::$isTrash = false [protected]

Definition at line 15 of file aliroFolder.php.


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

Generated on Wed May 14 13:01:59 2008 for ALIRO by  doxygen 1.5.5