get() public méthode

Getter method, allows $model->get('property') access to data
public get ( string $property ) : string
$property string
Résultat string
Exemple #1
0
 /**
  * Get the value of the field of a loaded model. If model is not loaded
  * will return default value instead.
  *
  * @return mixed current value of a field
  */
 public function get()
 {
     if ($this->owner->loaded() || isset($this->owner->data[$this->short_name])) {
         return $this->owner->get($this->short_name);
     }
     return $this->defaultValue();
 }
Exemple #2
0
 /**
  * Creates a new ModelField. The example below creates a ModelField which
  * lists client accounts for selection.
  * 
  * @code
  * $clients = new ModelField("brokerage.setup.clients.client_id", "account");
  * @endcode
  * @param $path The full path to the field in the module which is to be returned by this field.
  * @param $value The name of the field from the model whose value should be displayed in the list.
  */
 public function __construct($path, $value)
 {
     global $redirectedPackage;
     $this->info = Model::resolvePath($path);
     $this->model = Model::load((substr($this->info["model"], 0, 1) == "." ? $redirectedPackage : "") . $this->info["model"]);
     $this->valueField = $value;
     $field = $this->model->getFields(array($value));
     $this->setLabel($field[0]["label"]);
     $this->setDescription($field[0]["description"]);
     $this->setName($this->info["field"]);
     $params = array("fields" => array($this->info["field"], $this->valueField), "sort_field" => $this->valueField);
     if ($this->conditions != '') {
         $params['conditions'] = $this->conditions;
     }
     $data = $this->model->get($params, Model::MODE_ARRAY);
     $this->addOption("Add new " . Utils::singular($this->model->getEntity()), 'NEW');
     foreach ($data as $datum) {
         if ($datum[1] == "") {
             $this->addOption($datum[0]);
         } else {
             $this->addOption($datum[1], $datum[0]);
         }
     }
     $modelPath = str_replace('.', '/', $this->model->package);
     $this->addAttribute('onchange', "fapiAddModelItem('{$modelPath}', this, '{$value}')");
 }
Exemple #3
0
 public static function remover(Model $imagem)
 {
     if ($imagem->get("id_imagem")) {
         $sql = "delete from imagem where id_imagem = :id_imagem";
     }
     return self::exec($sql, $imagem);
 }
Exemple #4
0
 public static function remover(Model $origem_cliente)
 {
     if ($origem_cliente->get("id")) {
         $sql = "delete from origem_cliente where id = :id";
     }
     return self::exec($sql, $origem_cliente);
 }
Exemple #5
0
 public static function removerTodosPorGaleria(Model $galeria_item)
 {
     if ($galeria_item->get('id_galeria')) {
         $sql = "delete from galeria_item where id_galeria = :id_galeria";
     }
     return self::exec($sql, $galeria_item);
 }
Exemple #6
0
 public static function remover(Model $produto)
 {
     if ($produto->get("id")) {
         $sql = "delete from produto where id = :id";
     }
     return self::exec($sql, $produto);
 }
Exemple #7
0
 public static function remover(Model $modalidade)
 {
     if ($modalidade->get("id")) {
         $sql = "delete from modalidade where id = :id";
     }
     return self::exec($sql, $modalidade);
 }
Exemple #8
0
 public static function remover(Model $status_visita)
 {
     if ($status_visita->get("id")) {
         $sql = "delete from status_visita_orientacao where id = :id";
     }
     return self::exec($sql, $status_visita);
 }
 public static function remover(Model $motivo_nao_orientacao)
 {
     if ($motivo_nao_orientacao->get("id")) {
         $sql = "delete from motivo_nao_orientacao where id = :id";
     }
     return self::exec($sql, $motivo_nao_orientacao);
 }
Exemple #10
0
 public static function remover(Model $centro_custo)
 {
     if ($centro_custo->get("id")) {
         $sql = "delete from centro_custo where id = :id";
     }
     return self::exec($sql, $centro_custo);
 }
Exemple #11
0
 public static function remover(Model $log)
 {
     if ($log->get("id")) {
         $sql = "delete from log where id = :id";
     }
     return self::exec($sql, $log);
 }
Exemple #12
0
 public static function remover(Model $uf)
 {
     if ($uf->get("id")) {
         $sql = "delete from uf where id = :id";
     }
     return self::exec($sql, $uf);
 }
Exemple #13
0
 public static function consultarPorCodigo(Model $agencia_producao)
 {
     if ($agencia_producao->get('codigo')) {
         $sql = "select ap.id,\n                           ap.nome,\n                           ap.codigo,\n                           u.id as id_uf,\n                           u.nome as uf\n                      from agencia_producao ap\n                      inner join uf u\n                      on ap.id_uf = u.id\n                     where codigo = :codigo\n                       and ativo = :ativo";
         return self::query($sql, $agencia_producao);
     }
 }
Exemple #14
0
 public static function remover(Model $tipo_aval)
 {
     if ($tipo_aval->get("id")) {
         $sql = "delete from tipo_aval where id = :id";
     }
     return self::exec($sql, $tipo_aval);
 }
Exemple #15
0
 public static function remover(Model $video_youtube)
 {
     if ($video_youtube->get("id_youtube")) {
         $sql = "delete from youtube where id_youtube = :id_youtube";
     }
     return self::exec($sql, $video_youtube);
 }
Exemple #16
0
 public static function remover(Model $variaveis)
 {
     if ($variaveis->get("id")) {
         $sql = "delete from variaveis where id = :id";
     }
     return self::exec($sql, $variaveis);
 }
Exemple #17
0
 public static function remover(Model $status_contrato)
 {
     if ($status_contrato->get("id")) {
         $sql = "delete from status_contrato where id = :id";
     }
     return self::exec($sql, $status_contrato);
 }
 public function get($key)
 {
     if ($key == 'requires' || $key == 'provides' || $key == 'screenshots' || $key == 'upgrades') {
         return unserialize(parent::get($key));
     } else {
         return parent::get($key);
     }
 }
 public function get($key)
 {
     if ($key == 'post') {
         return Model::factory('post')->load($this->get('post_id'));
     } else {
         return parent::get($key);
     }
 }
 public function get($key)
 {
     if ($key == 'comments') {
         return Model::factory('comment')->load_all('post_id = ' . $this->get('id'));
     } else {
         return parent::get($key);
     }
 }
Exemple #21
0
 public static function consultarProdutosPorString(Model $produto_producao)
 {
     $sql = "select *\n                  from produto_producao pp\n                  inner join producao p\n                  on pp.id_producao = p.id\n                  where numero_contrato in (:strContratos)\n                    and p.ativo = 1";
     if ($produto_producao->get('id_producao')) {
         $sql .= " and pp.id_producao <> :id_producao";
     }
     return self::query($sql, $produto_producao, false);
 }
 public static function save()
 {
     print_r($_POST);
     exit;
     $model = new Model();
     $model->save($data);
     $response = $model->get();
     return View::render('index', $response);
 }
Exemple #23
0
 public function get($property)
 {
     $field = $this->getField($property);
     if ($field instanceof DateTime) {
         return \DateTime::createFromFormat("Y-m-d H:i:s", parent::get($property));
     } else {
         return call_user_func_array("parent::get", func_get_args());
     }
 }
Exemple #24
0
 /**
  * Gets the active theme name
  *
  * @return string
  */
 public static function getTheme()
 {
     // theme name has not yet been saved, fetch and save it
     if (!self::$theme) {
         self::$theme = Model::get('fork.settings')->get('Core', 'theme', null);
     }
     // return theme name
     return self::$theme;
 }
Exemple #25
0
 public function get($options = array())
 {
     if (empty($options['id'])) {
         $options['id'] = null;
     }
     $options['fields'] = 'alumni.id, alumni.firstname, alumni.lastname, schools.name AS school';
     $this->table = 'alumni LEFT JOIN schools ON alumni.school_id = schools.id';
     return parent::get($options);
 }
Exemple #26
0
 function get($criteria = null)
 {
     if (is_numeric($criteria)) {
         $sql = $this->generate_base_sql_for_get() . " WHERE files.id = {$criteria}";
         return parent::get_one($sql);
     } else {
         //if we're not getting a specific file, the base get function is fine
         return parent::get($this->modify_sql_for_user_type(''));
     }
 }
Exemple #27
0
 /**
  * Display the items already in the database for detailed viewing.
  * @param $params An array of parameters that the system uses.
  * @return string
  */
 public function view($params)
 {
     $form = $this->getForm();
     $form->setShowField(false);
     $data = $this->model->get(array("filter" => $this->model->getKeyField() . "=?", "bind" => [$params[0]]), SQLDatabaseModel::MODE_ASSOC, true, false);
     $form->setData($data[0]);
     $this->label = "View " . $this->label;
     return $form->render();
     //ModelController::frameText(400,$form->render());
 }
 public function get($k)
 {
     $k = strtolower($k);
     switch ($k) {
         case 'baseurl':
             return '/navigation/view/' . $this->_data['id'];
             break;
         default:
             return parent::get($k);
     }
 }
Exemple #29
0
 public function get($project_id)
 {
     $project = parent::get($project_id);
     if ($project->created_at) {
         $project->created_at = date_create($project->created_at)->format('d/m/Y');
     }
     if ($project->updated_at) {
         $project->updated_at = date_create($project->updated_at)->format('d/m/Y');
     }
     return $project;
 }