Ejemplo n.º 1
0
 /**
  * @param $conditions string[] the key is the name of the condition, the value is the name of the
  *   value that enables the condition
  * @param $filters string[] the key is the name of the filter, the value is the name of the form
  *   containing its value
  * @return string
  */
 public function buildObject($conditions = null, $filters = null)
 {
     if (!isset($conditions)) {
         $conditions_values = $this->property->getListAnnotation('conditions')->values();
         if ($conditions_values) {
             foreach ($conditions_values as $condition) {
                 if (strpos($condition, '=')) {
                     list($name, $condition) = explode('=', $condition);
                 } else {
                     $name = $condition;
                 }
                 $conditions[$name] = isset($conditions[$name]) ? $conditions[$name] . ',' . $condition : $condition;
             }
         }
     }
     if (!isset($filters)) {
         $filters_values = $this->property->getListAnnotation('filters')->values();
         if ($filters_values) {
             $properties = $this->property->getDeclaringClass()->getProperties([T_EXTENDS, T_USE]);
             foreach ($filters_values as $filter) {
                 if ($properties[$filter]->getType()->isClass()) {
                     $filter = 'id_' . $filter;
                 }
                 $filters[$filter] = $filter;
             }
         }
     }
     return parent::buildObject($conditions, $filters);
 }
 /**
  * @param $object object
  * @return string HTML combo-box with filters
  */
 protected function getCombo($object)
 {
     $class_name = get_class($object);
     $edit = new Html_Builder_Type('replace_with', new Type($class_name), Builder::create($class_name));
     return $edit->buildObject(null, $this->getFilters($object));
 }