コード例 #1
0
ファイル: ca_lists.php プロジェクト: ffarago/pawtucket2
 /**
  *
  */
 public function addItem($ps_value, $pb_is_enabled = true, $pb_is_default = false, $pn_parent_id = null, $pn_type_id = null, $ps_idno = null, $ps_validation_format = '', $pn_status = 0, $pn_access = 0, $pn_rank = null)
 {
     if (!($vn_list_id = $this->getPrimaryKey())) {
         return null;
     }
     $t_item = new ca_list_items();
     $t_item->setMode(ACCESS_WRITE);
     if ($this->inTransaction()) {
         $t_item->setTransaction($this->getTransaction());
     }
     $t_item->set('list_id', $vn_list_id);
     $t_item->set('item_value', $ps_value);
     $t_item->set('is_enabled', $pb_is_enabled ? 1 : 0);
     $t_item->set('is_default', $pb_is_default ? 1 : 0);
     $t_item->set('parent_id', $pn_parent_id);
     $t_item->set('type_id', $pn_type_id);
     $t_item->set('idno', $ps_idno);
     $t_item->set('validation_format', $ps_validation_format);
     $t_item->set('status', $pn_status);
     $t_item->set('access', $pn_access);
     if (!is_null($pn_rank)) {
         $t_item->set('rank', $pn_rank);
     }
     $vn_item_id = $t_item->insert();
     if ($t_item->numErrors()) {
         $this->errors = array_merge($this->errors, $t_item->errors);
         return false;
     }
     return $t_item;
 }