コード例 #1
0
 private function _getModelAttributesForViews()
 {
     $attributes = array();
     $ModelInstance = Ak::get($this->class_name);
     if ($ModelInstance instanceof $this->class_name) {
         $table_name = $ModelInstance->getTableName();
         if (!empty($table_name)) {
             $attributes = $ModelInstance->getContentColumns();
             unset($attributes['updated_at'], $attributes['updated_on'], $attributes['created_at'], $attributes['created_on']);
         }
         $internationalized_columns = $ModelInstance->getInternationalizedColumns();
         foreach ($internationalized_columns as $column_name => $languages) {
             foreach ($languages as $lang) {
                 $attributes[$column_name] = $attributes[$lang . '_' . $column_name];
                 $attributes[$column_name]['name'] = $column_name;
                 unset($attributes[$lang . '_' . $column_name]);
             }
         }
     }
     $helper_methods = array('string' => 'text_field', 'text' => 'text_area', 'date' => 'text_field', 'datetime' => 'text_field');
     foreach ($attributes as $k => $v) {
         $attributes[$k]['type'] = $helper_methods[$attributes[$k]['type']];
     }
     return $attributes;
 }
コード例 #2
0
ファイル: observer.php プロジェクト: bermi/akelos
 /**
  * Constructs the Observer
  * @param $subject the name or names of the Models to observe
  */
 public function setObservedModels()
 {
     $args = func_get_args();
     $models = func_num_args() == 1 ? is_array($args[0]) ? $args[0] : array($args[0]) : $args;
     foreach ($models as $class_name) {
         $Object = Ak::get($class_name);
         $this->observe($Object);
     }
 }
コード例 #3
0
ファイル: action_controller.php プロジェクト: bermi/akelos
 protected function __getFailOver($name)
 {
     $this->{$name} = Ak::get($name);
     return $this->{$name} instanceof AkBaseModel;
 }