コード例 #1
0
ファイル: XmlQuery.php プロジェクト: Raul-mz/web-erpcya
 /**
  * Treats a <orderby> node and its children <field> nodes
  *
  * @param SimpleXmlElement $orderby
  * @param string           $selectedOrderingGroup  The ordergroup to select and use for ordering
  */
 public function process_orderby($orderby, $selectedOrderingGroup = null)
 {
     if ($orderby) {
         if ($selectedOrderingGroup) {
             $this->process_orderby($orderby->getChildByNameAttr('ordergroup', 'name', $selectedOrderingGroup));
             return;
         }
         foreach ($orderby->children() as $o) {
             /** @var $o SimpleXmlElement */
             if ($o->getName() == 'field') {
                 list($fieldsArray) = $this->get_field($o);
                 $this->processJoinsNeededForCount($fieldsArray);
                 $this->orderArray[] = array_pop($fieldsArray) . ($o->attributes('ordering') === 'DESC' ? ' DESC' : '');
             } elseif ($o->getName() == 'ordergroup') {
                 continue;
             } else {
                 trigger_error('SQLXML::process_orderby: child type ' . $o->getName() . ' of orderby is not implemented !', E_USER_NOTICE);
             }
         }
     }
 }