예제 #1
0
파일: order.php 프로젝트: alexmixaylov/real
 /**
  * @param array $args
  * @return string
  */
 public function renderAdminPosition($args = array())
 {
     // init vars
     $elements = array();
     $output = array();
     $style = isset($args['style']) ? $args['style'] : 'adminedit';
     $layout = $this->_layout;
     $this->_order = isset($args['order']) ? $args['order'] : $this->_order;
     $fields = $this->_order->getFields();
     // render elements
     foreach ($fields as $identifier => $data) {
         if ($element = $this->_order->getFieldElement($identifier)) {
             $element->bindData($data);
             $data['_layout'] = $this->_layout;
             $data['_index'] = $identifier;
             // set params
             $params = array_merge((array) $data, $args);
             // check value
             $elements[] = compact('element', 'params');
         }
     }
     foreach ($elements as $i => $data) {
         $output[$i] = parent::render('element.' . $style, array('element' => $data['element'], 'params' => array_merge(array('first' => $i == 0, 'last' => $i == count($elements) - 1), $data['params'])));
     }
     // restore layout
     $this->_layout = $layout;
     return implode(PHP_EOL, $output);
 }