contentData Class Reference

Inherits DataStatmentFO, and Interfacedata.

List of all members.

Static Public Member Functions

Static Public Attributes

Protected Member Functions

Static Protected Member Functions

Static Protected Attributes

Static Private Member Functions

  • static add_cache ($id)
    Mise en pile de toutes les element des page de cms.
  • static in_cache ()
    Appel et recup des element du cache.
  • static extract_img ($id, $content, $pattern)
    Extract img et complete cache avec img extraites.
  • static parse_content ($content, $id)
    Parse content texte Fucntion qui permet de prendre en charge des element contenu dans la description du cms.

Static Private Attributes


Detailed Description

Definition at line 70 of file driver.content.php.


Constructor & Destructor Documentation

contentData::__construct (  )  [protected]

Definition at line 94 of file driver.content.php.

00094                                    {
00095     global $languages_id;
00096     self::start();
00097   }


Member Function Documentation

static contentData::add_cache ( id  )  [static, private]

Mise en pile de toutes les element des page de cms.

Definition at line 115 of file driver.content.php.

Referenced by statment_query().

00115                                         {
00116     self::$cache[]=$id;
00117   }

static contentData::add_where_query ( add  )  [static, protected]

Ajout constrainte clause where.

Definition at line 160 of file driver.content.php.

Referenced by get_cms_liste_byDate(), get_content_in_cat(), and get_query().

00160 { self::$where_query .=' '.$add; }

static contentData::cstr_query ( orderby = '',
limit = '',
option = '' 
) [static, protected]

Requeteur.

Definition at line 169 of file driver.content.php.

Referenced by get_cms_liste_byDate().

00169                                                                           {
00170     $query="SELECT content_title AS title, c.content_id AS id, c.content_name AS name, content_text AS text
00171             FROM " . TABLE_CONTENT_DESCRIPTION . " cd, " . TABLE_CONTENT . " c,   " . TABLE_CONTENT_TO_CATEGORIES . " ctc, " . TABLE_CATEGORIES . " cat
00172             WHERE cat.categories_id=ctc.categories_id and cat.categories_status='1'  AND c.content_status = '1' AND c.content_id = ctc.content_id AND cd.content_id = ctc.content_id AND cd.language_id = '" . self::$lg_id . "' " ;
00173 
00174     $query .=self::$where_query;
00175     $query .=' ORDER BY ' .(!tep_not_null($orderby)? ' c.sort_order, c.content_name ASC  ' : $orderby) ;
00176     $query .=' LIMIT '.(!tep_not_null($limit)? '1' : $limit) ;
00177 
00178     return $query;
00179   }

static contentData::extract_img ( id,
content,
pattern 
) [static, private]

Extract img et complete cache avec img extraites.

mise en cache

Definition at line 184 of file driver.content.php.

Referenced by parse_content().

00184                                                             {
00185     $pattern = "#<img.+[^>]/>#i";
00186     preg_match_all($pattern, $content, $images);
00188     self::$array_data[$id]->images=$images ;
00189   }

static contentData::get_cms_liste_byDate ( max = 10,
exclude = '' 
) [static]

Recupere la liste des article cms triée par date.

Note:
Article Type News, not in Page_xxx
Author:
oscim - <mail aurelien@oscim.fr> <www http://www.oscim.fr>
Parameters:
@a int max le nombre d'item dans le tableau array tableau d'exclusion des id
Returns:
array

Definition at line 335 of file driver.content.php.

00335                                                                     {
00336     global $languages_id;
00337 
00338     self::start();
00339     self::reset_query();
00340     $DB=Database::getInstance();
00341     self::$lg_id=(int)$languages_id;
00342     self::add_where_query(" AND content_name NOT LIKE 'Page_%' ");
00343     $sql=self::cstr_query(" c.date_added DESC ", $max);
00344     $content_query = $DB->query($sql);
00345 
00346     return self::statment_query($content_query,$exclude);
00347   }

static contentData::get_content_cat ( content_id  )  [static]

Function recuperation de la cat d'un content_id.

Author:
oscim <mail a@oscim.fr /><web http://www.oscim.fr /> - OscssTeam
Parameters:
@a int l'id de la cat

mise en cache

Definition at line 286 of file driver.content.php.

00286                                                      {
00287     $DB=Database::getInstance();
00288     $cur = $DB->query("SELECT categories_id from " . TABLE_CONTENT_TO_CATEGORIES . " WHERE content_id='" . (int)$content_id . "'");
00289     if($cur->__get('numRows')) {
00290       $display = $cur->fetchAssoc();
00292       self::$array_data[$content_id]->parent_id=$display['categories_id'];
00293       return $display['categories_id'];
00294     }
00295     else return false;
00296   }

static contentData::get_content_in_cat ( current_category_id = 0,
exclude = '',
option = '' 
) [static]

Function recuperation des page associé a une cat.

Author:
oscim <mail a@oscim.fr /><web http://www.oscim.fr /> - OscssTeam
Parameters:
@a int l'id de la categorie courante ou null array tableau d'exclusion

Definition at line 226 of file driver.content.php.

00226                                                                                            {
00227     global $languages_id;
00228     self::start($option);
00229     self::reset_query();
00230     $DB=Database::getInstance();
00231     self::$lg_id=(int)$languages_id;
00232     self::add_where_query(" AND ctc.categories_id = '" . (int)$current_category_id . "' ");
00233     $content_query = $DB->query($sql=self::cstr_query('',25) );
00234 
00235     return self::statment_query($content_query,$exclude);
00236   }

static contentData::get_content_path ( content_id  )  [static]

Construct a category path to the product.

Author:
oscim <mail a@oscim.fr /><web http://www.oscim.fr /> - OscssTeam
Parameters:
@a int l'id de la ressource

Definition at line 304 of file driver.content.php.

00304                                                        {
00305     $cPath = '';
00306 
00307     $category_query = tep_db_query("select p2c.categories_id from " . TABLE_CONTENT . " p, " . TABLE_CONTENT_TO_CATEGORIES . " p2c where p.content_id = '" . (int)$content_id . "' and p.content_status = '1' and p.content_id = p2c.content_id limit 1");
00308     if (tep_db_num_rows($category_query)) {
00309       $category = tep_db_fetch_array($category_query);
00310 
00311       $categories = array();
00312       tep_get_parent_categories($categories, $category['categories_id']);
00313 
00314       $categories = array_reverse($categories);
00315 
00316       $cPath = implode('_', $categories);
00317 
00318       if (tep_not_null($cPath)) $cPath .= '_';
00319       $cPath .= $category['categories_id'];
00320     }
00321 
00322     return $cPath;
00323   }

static contentData::get_img ( id,
img_num = 0 
) [static]

Return balise img.

Definition at line 352 of file driver.content.php.

00352                                                  {
00353     if(is_array( self::$array_data[$id]->images[$img_num])&& isset( self::$array_data[$id]->images[$img_num][0]) )
00354       return (string)self::$array_data[$id]->images[$img_num][0];
00355   }

static contentData::get_item ( id  )  [static]

Alias unique ID.

Definition at line 266 of file driver.content.php.

00266                                       {
00267     $db_list=self::get_query($id);
00268 
00269     if(is_numeric($id) && isset($db_list[(int)$id])){
00270       return $db_list[$id];
00271     }else{
00272       $db_list=self::get_query('',$id);
00273       foreach($db_list as $item)
00274         if((string)$id==(string)$item->name)return $item;
00275     }
00276     return false;
00277   }

static contentData::get_query ( id = '',
search = '',
exclude = '',
option = array() 
) [static]

Appel item.

Parameters:
@a string content_name le nom du titre array tableau d'exclusion

soit id soit sherach name key

Definition at line 244 of file driver.content.php.

Referenced by get_item().

00244                                                                                  {
00245     global $languages_id;
00246 
00247     self::start($option);
00248 
00249     self::reset_query();
00250     $DB=Database::getInstance();
00251     self::$lg_id=(int)$languages_id;
00252     $search=tep_db_prepare_input($search);
00253 
00254     if (count(self::$cache)>0) self::add_where_query(' AND c.content_id NOT IN ('.self::in_cache().') ');
00256     self::add_where_query((tep_not_null($id) && is_numeric($id) ? " AND c.content_id = '" . $id . "' ": (!empty($search)?" AND content_name LIKE '%" . tep_db_input($search) . "%' ":'') ));
00257 
00258     $content_query = $DB->query($sql=self::cstr_query((string)@$option['orderby'],@$option['limit'],(array)@$option) );
00259 
00260     return self::statment_query($content_query,$exclude,$search);
00261   }

static contentData::getInstance (  )  [static]

Definition at line 208 of file driver.content.php.

Referenced by get_cms_liste_byDate(), get_content_cat(), get_content_in_cat(), get_query(), resetInstance(), and start().

00208                                        {
00209     if(self::$_instance == null) self::$_instance = new self();
00210     return self::$_instance;
00211   }

static contentData::in_cache (  )  [static, private]

Appel et recup des element du cache.

Definition at line 122 of file driver.content.php.

00122                                     {
00123     return implode("," ,self::$cache);
00124   }

static contentData::parse_content ( content,
id 
) [static, private]

Parse content texte Fucntion qui permet de prendre en charge des element contenu dans la description du cms.

Definition at line 195 of file driver.content.php.

Referenced by statment_query().

00195                                                      {
00196 
00197     $pattern ="#<img (.+)[^>]/>#i";
00198     self::extract_img($id,$content,$pattern);
00199 
00200     $sortie=(isset(self::$opt['img']) && !_test_bool(self::$opt['img']))? preg_replace($pattern, '', $content) : $content;
00201     $sortie=(isset(self::$opt['more']) && _test_bool(self::$opt['more']))?  substr($sortie, 0, strpos($sortie,'<!-- pagebreak -->')) : $sortie;
00202     return $sortie;
00203   }

static contentData::reset_query (  )  [static, protected]

Definition at line 164 of file driver.content.php.

Referenced by get_cms_liste_byDate(), get_content_in_cat(), and get_query().

00164 { self::$where_query=''; }

static contentData::resetInstance (  )  [static]

Definition at line 213 of file driver.content.php.

00213                                         {
00214     self::$_instance = null;
00215     return self::getInstance();
00216   }

static contentData::start ( option = ''  )  [static]

Definition at line 101 of file driver.content.php.

Referenced by __construct(), content::__construct(), get_cms_liste_byDate(), get_content_in_cat(), and get_query().

00101                                           {
00102     global $languages_id;
00103     self::$lg_id=(int)$languages_id;
00104     $DB=Database::getInstance();
00105     self::$obj_language = $DB->query("select code from " . TABLE_LANGUAGES . " where languages_id='" .self::$lg_id . "'");
00106 
00107     if(!empty($option) && is_array($option)) self::$opt=$option;
00108 
00109   }

static contentData::statment_query ( content_query,
exclude = '',
search = '' 
) [static, protected]

Prepa donnée sortie.

Definition at line 129 of file driver.content.php.

Referenced by get_cms_liste_byDate(), get_content_in_cat(), and get_query().

00129                                                                                  {
00130 
00131     $display_lang=self::$obj_language->fetchAssoc();
00132     if (empty($exclude))$exclude=array();
00133     $tabl=$res=array();
00134     while ($content = $content_query->fetchAssoc()) {
00135       if (!in_array($content['name'],$exclude)) {
00136         $res=$content;
00137         $res['href']=tep_href_link(FILENAME_CONTENT,'content=' . $content['id'] . '&amp;language=' . $display_lang['code']);
00138         $res['key']=$content['name'];
00139         $res['original']=$content['text'];
00140         $res['images']=array();
00141 
00142         self::$array_data[$content['id']]=$tabl[$content['id']]=new objectInfo($res);
00143         self::$array_data[$content['id']]->text=self::parse_content($res['text'],$content['id']);
00144         self::add_cache($content['id']);
00145       }
00146     }
00147 
00148     if((count(self::$array_data)>0))
00149     foreach(self::$array_data as $k=>$content)
00150       if (!in_array($content->name,$exclude)) {
00151         if((!empty($search) && strstr($content->name,$search) !=false) || empty($search)) $tabl[$content->id]=$content;
00152       }
00153 
00154     return $tabl;
00155   }


Member Data Documentation

contentData::$_instance [static, protected]

object

Definition at line 90 of file driver.content.php.

contentData::$array_data = array() [static]

array cache

Definition at line 85 of file driver.content.php.

contentData::$cache = array() [static]

array

Definition at line 79 of file driver.content.php.

contentData::$lg_id [static]

int

Definition at line 75 of file driver.content.php.

contentData::$obj_language [static]

obj res db

Definition at line 77 of file driver.content.php.

contentData::$opt = array() [static]

array

Definition at line 82 of file driver.content.php.

contentData::$where_query = '' [static, private]

string

Definition at line 88 of file driver.content.php.


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