示例#1
0
 /**
  * Return a given category lineage
  *
  * @param array $values : parameters values array(parameterName => parameterValue) in :
  *     category : the category id
  * @param multidimentionnal array $tags : xml2Array content of atm-function tag
  *     ... {id} ... {label} ...
  * @return string : the category
  * @access public
  */
 function category($values, $tags)
 {
     global $cms_language;
     $return = "";
     if (!sensitiveIO::isPositiveInteger($values['category'])) {
         $this->raiseError("Category value parameter must be a valid category ID : " . $values['category']);
         return false;
     }
     if (!isset($tags[0]['textnode'])) {
         $this->raiseError("atm-function tag must have a content");
         return false;
     }
     $params = $this->getParamsValues();
     $category = new CMS_moduleCategory($values['category']);
     if ($category->hasError()) {
         $this->raiseError("Category " . $values['category'] . " has an error ...");
         return false;
     }
     $replace = array('{id}' => $values['category'], '{label}' => $category->getLabel($cms_language), '{description}' => $category->getDescription($cms_language));
     $xml2Array = new CMS_XML2Array();
     $xml = $xml2Array->toXML($tags);
     $return .= str_replace(array_keys($replace), $replace, $xml);
     return $return;
 }