Пример #1
0
 function process()
 {
     //$this->_details_fields();
     $result = parent::process();
     switch ($this->_action) {
         case "update":
             if ($this->on_error()) {
                 $this->_status = "modify";
                 $this->_process_uri = $this->rapyd->uri->uri_string();
                 $this->_details_fields();
                 $this->_sniff_fields();
                 $this->_build_buttons();
                 $this->_rel_script();
                 $this->build_form();
             }
             if ($this->on_success()) {
                 $this->_postprocess_uri .= "/" . $this->rapyd->uri->build_clause("show" . $this->pk_to_URI($this->_dataobject->pk));
                 if ($this->back_save) {
                     header("Refresh:0;url=" . $this->back_url);
                 } else {
                     redirect("/" . $this->_postprocess_uri, 'refresh');
                 }
             }
             break;
         case "insert":
             if ($this->on_error()) {
                 $this->_status = "create";
                 $this->_process_uri = $this->rapyd->uri->uri_string();
                 $this->_details_fields();
                 $this->_sniff_fields();
                 $this->_build_buttons();
                 $this->_rel_script();
                 $this->build_form();
             }
             if ($this->on_success()) {
                 $this->_postprocess_uri .= $this->pk_to_URI($this->_dataobject->pk);
                 if ($this->back_save) {
                     header("Refresh:0;url=" . $this->back_url);
                 } else {
                     redirect($this->_postprocess_uri, 'refresh');
                 }
             }
             break;
         case "delete":
             if ($this->on_error()) {
                 $this->_build_buttons();
                 if (empty($this->_dataobject->error_message_ar['pre_del'])) {
                     $this->build_message_form(RAPYD_MSG_0206);
                 } else {
                     $this->build_message_form($this->_dataobject->error_message_ar['pre_del']);
                 }
             }
             if ($this->on_success()) {
                 $this->_build_buttons();
                 if ($this->back_delete) {
                     header("Refresh:0;url=" . $this->back_url);
                 } else {
                     $this->build_message_form(RAPYD_MSG_0202);
                 }
             }
             break;
     }
     switch ($this->_status) {
         case "show":
         case "modify":
         case "create":
             //$this->_details_fields();
             $this->_build_buttons();
             $this->_rel_script();
             $this->build_form();
             break;
         case "delete":
             //$this->_details_fields();
             $this->_build_buttons();
             $this->build_message_form(RAPYD_MSG_0209);
             break;
         case "unknow_record":
             //$this->_details_fields();
             $this->_build_buttons();
             $this->build_message_form(RAPYD_MSG_0208);
             break;
     }
 }
Пример #2
0
 function process($miview = 'dataform')
 {
     $result = parent::process();
     switch ($this->_action) {
         case 'search':
             // prepare the WHERE clause
             foreach ($this->_fields as $fieldname => $field) {
                 if ($field->value != '') {
                     if (strpos($field->name, '_copy') > 0) {
                         $name = substr($field->db_name, 0, strpos($field->db_name, '_copy'));
                     } else {
                         $name = $field->db_name;
                     }
                     $field->_getValue();
                     $field->_getNewValue();
                     $value = $field->newValue;
                     switch ($field->clause) {
                         case 'like':
                             //$this->db->like($name, $value,$field->like_side);
                             $comodin = $this->ci->datasis->traevalor('COMODIN');
                             if (!empty($comodin)) {
                                 $v = str_replace($comodin, '%', $value);
                             } else {
                                 $v = $value;
                             }
                             if ($field->like_side == 'before') {
                                 $v = $this->db->escape('%' . $v);
                             } elseif ($field->like_side == 'after') {
                                 $v = $this->db->escape($v . '%');
                             } else {
                                 $v = $this->db->escape('%' . $v . '%');
                             }
                             $strlike = "{$name} LIKE {$v}";
                             $this->db->where($strlike);
                             break;
                         case 'orlike':
                             $this->db->orlike($name, $value);
                             break;
                         case 'where':
                             /*if(is_numeric($value)){
                             			$value =1*$value;
                             			$bool  =FALSE;
                             		}else{
                             			$bool=TRUE;
                             		}*/
                             $this->db->where($name . ' ' . $field->operator, $value);
                             break;
                         case 'orwhere':
                             /*if(is_numeric($value)){
                             			$value =1*$value;
                             			$bool  =FALSE;
                             		}else{
                             			$bool=TRUE;
                             		}*/
                             $this->db->orwhere($name . ' ' . $field->operator, $value);
                             break;
                             //..
                     }
                 }
             }
             $this->_build_buttons();
             $this->build_form($miview);
             break;
         case 'reset':
             //pulire sessioni
             $this->_build_buttons();
             $this->build_form($miview);
             break;
         default:
             $this->_build_buttons();
             $this->build_form($miview);
             break;
     }
 }
Пример #3
0
 function process()
 {
     $result = parent::process();
     switch ($this->_action) {
         case "update":
             if ($this->on_error()) {
                 $this->_status = 'modify';
                 $this->_process_uri = $this->rapyd->uri->uri_string();
                 $this->_sniff_fields();
                 $this->_build_buttons();
                 $this->build_form();
             }
             if ($this->on_success()) {
                 $this->_postprocess_uri .= '/' . $this->rapyd->uri->build_clause('show' . $this->pk_to_URI($this->_dataobject->pk));
                 if ($this->on_save_redirect) {
                     if ($this->back_save) {
                         header("Refresh:0;url=" . $this->back_url);
                     } else {
                         redirect('/' . $this->_postprocess_uri, 'refresh');
                     }
                 }
             }
             break;
         case "insert":
             if ($this->on_error()) {
                 $this->_status = 'create';
                 $this->_process_uri = $this->rapyd->uri->uri_string();
                 $this->_sniff_fields();
                 $this->_build_buttons();
                 $this->build_form();
             }
             if ($this->on_success()) {
                 $this->_postprocess_uri .= $this->pk_to_URI($this->_dataobject->pk);
                 if ($this->on_save_redirect) {
                     if ($this->back_save) {
                         header("Refresh:0;url=" . $this->back_url);
                     } else {
                         redirect($this->_postprocess_uri, 'refresh');
                     }
                 }
             }
             break;
         case 'delete':
             if ($this->on_error()) {
                 $this->_build_buttons();
                 if (empty($this->_dataobject->error_message_ar['pre_del'])) {
                     $this->build_message_form(RAPYD_MSG_0206);
                 } else {
                     $this->build_message_form($this->_dataobject->error_message_ar['pre_del']);
                 }
             }
             if ($this->on_success()) {
                 $this->_build_buttons();
                 if ($this->back_delete) {
                     header("Refresh:0;url=" . $this->back_url);
                 } else {
                     $this->build_message_form(RAPYD_MSG_0202);
                 }
             }
             break;
     }
     switch ($this->_status) {
         case 'show':
         case 'modify':
         case 'create':
             $this->_build_buttons();
             $this->build_form();
             break;
         case 'delete':
             $this->_build_buttons();
             $this->build_message_form(RAPYD_MSG_0209);
             break;
         case 'unknow_record':
             $this->_build_buttons();
             $this->build_message_form(RAPYD_MSG_0208);
             break;
     }
 }
Пример #4
0
 function process()
 {
     $result = parent::process();
     switch ($this->_action) {
         case "search":
             // prepare the WHERE clause
             foreach ($this->_fields as $fieldname => $field) {
                 if ($field->value != "") {
                     if (strpos($field->name, "_copy") > 0) {
                         $name = substr($field->db_name, 0, strpos($field->db_name, "_copy"));
                     } else {
                         $name = $field->db_name;
                     }
                     $field->_getValue();
                     $field->_getNewValue();
                     $value = $field->newValue;
                     switch ($field->clause) {
                         case "like":
                             $this->db->like($name, $value, $field->like_side);
                             break;
                         case "orlike":
                             $this->db->orlike($name, $value);
                             break;
                         case "where":
                             $this->db->where($name . " " . $field->operator, $value);
                             break;
                         case "orwhere":
                             $this->db->orwhere($name . " " . $field->operator, $value);
                             break;
                             //..
                     }
                 }
             }
             $this->_build_buttons();
             $this->build_form();
             break;
         case "reset":
             //pulire sessioni
             $this->_build_buttons();
             $this->build_form();
             break;
         default:
             $this->_build_buttons();
             $this->build_form();
             break;
     }
 }