Пример #1
0
 /**
  * Constructor
  *
  * @param AM_Controller_Action $actionController Controller
  * @param string $name Component name
  * @param string $title Title of control
  * @param array $validationRules Validation rules. Each rule is array :
  * 		[validationtype, param1, param2,...]
  *     type can be: require, integer, float, numeric, maximum value, minimum value,
  * 	 	maximum length, minimum length, range, range length, regexp, email, function
  */
 public function __construct(AM_Controller_Action $actionController, $name, $title = null, array $validationsRules = null)
 {
     parent::__construct($actionController, $name);
     if ($title) {
         $this->title = $title;
     } else {
         $this->title = $name;
     }
     if ($validationsRules) {
         $this->addValidationRules($validationsRules);
     }
 }
Пример #2
0
 /**
  * Return Errors list
  * @return array
  */
 public function getErrors()
 {
     $errors = parent::getErrors();
     foreach ($this->controls as $control) {
         $errors = array_merge($errors, $control->getErrors());
     }
     return $errors;
 }
Пример #3
0
 /**
  * Constructor
  *
  * @param AM_Controller_Action $actionController Controller
  * @param string $name Component name
  * @param Zend_Db_Adapter_Abstract Database Link
  * @param string $selectSQL SQL for selecting data
  * @param string $defaultSortOrder Default order
  * @param array $sortOrders Allowed orders
  * @param int/array $pageSize Page size or array($defaultPageSize, [$maxPageSize[, $minPageSize]]). In latest case pageSize can be setted from url
  * @param null/string $countSQLType How to coalculate count of rows. Leave empty for autodeterminating. Allowed values: SQL_CALC_FOUND_ROWS, simple, subselect
  */
 public function __construct(AM_Controller_Action $actionController, $name, Zend_Db_Adapter_Abstract $db = null, $selectSQL, $defaultSortOrder = null, $sortOrders = null, $pageSize = null, $countSQLType = null)
 {
     $this->db = $db;
     $this->selectSQL = $selectSQL;
     if ($defaultSortOrder) {
         $this->defaultSortOrder = $defaultSortOrder;
     }
     if ($sortOrders) {
         $this->sortOrders = $sortOrders;
     }
     if ($pageSize) {
         if (is_array($pageSize)) {
             $this->pageSize = $pageSize[0];
             $this->allowChangePageSize = true;
             if (count($pageSize) > 1) {
                 $this->maxPageSize = $pageSize[1];
             }
             if (count($pageSize) > 2) {
                 $this->minPageSize = $pageSize[2];
             }
         } else {
             $this->pageSize = $pageSize;
         }
     }
     if ($countSQLType) {
         $this->countSQLType = $countSQLType;
     }
     parent::__construct($actionController, $name);
 }