예제 #1
0
 /**
  * Creates and return eZPageBlockItem object from given XML
  *
  * @static
  * @param DOMElement $node
  * @return eZPageBlockItem
  */
 public static function createFromXML(DOMElement $node)
 {
     $newObj = new eZPageBlockItem();
     if ($node->hasAttributes()) {
         foreach ($node->attributes as $attr) {
             $newObj->setAttribute($attr->name, $attr->value);
         }
     }
     foreach ($node->childNodes as $node) {
         if ($node->nodeType == XML_ELEMENT_NODE) {
             $newObj->setAttribute($node->nodeName, $node->nodeValue);
         }
     }
     return $newObj;
 }
 /**
  * Sorting items based on the priority attribute
  *
  * @param eZPageBlockItem $a
  * @param eZPageBlockItem $b
  * @return integer
  */
 public function sortItemsByPriority( eZPageBlockItem $a, eZPageBlockItem $b )
 {
     if ( $a->attribute('priority') > $b->attribute('priority') )
     {
         return -1;
     }
     else if ( $a->attribute('priority') < $b->attribute('priority') )
     {
         return 1;
     }
     else
     {
         return 0;
     }
 }