if ($id) { //$data['_data']=$obj->getByID_v2($_POST[$_id]); $message = "Update Completed Successfully"; } else { $message = "Data not Updated"; } $_resource = $obj->getByID_v2(getREQUEST('uin')); $_data = $obj->Fetch($_resource); $data['_data'] = $_data; //var_dump($_data); } elseif ($_GET['action'] == 'add') { $id = $obj->insert(); if ($id > 0) { if (isset($_FILES['file'])) { //echo 'uploading file'; $upload_result = AR_UploadImage('file', $upload_dir, array(960, 960), $prefix, '', '', '', 1); //var_dump($upload_result); if (!$upload_result[0]) { $message = $upload_result[1]; } else { if ($upload_result[1] != $_data[$prefix . 'file']) { $obj->setFieldValues_v2("file", $upload_result[1]); $id = $obj->update($_POST['uin']); } } } $message = $module_Title . " Added Successfully"; } else { $message = $module_Title . " Not Added !"; } #$_resource=$obj->getByID_v2($_POST[$_id]);
} } if ($id) { $data['_data'] = $obj->getByID($_POST[$_id]); $message = "Update Completed Successfully"; } else { $message = "Date not Updated"; } $_resource = $obj->getByID($_POST[$_id]); $_data = $obj->Fetch($_resource); } elseif ($_GET['action'] == 'add') { $id = $obj->insert(); if ($id > 0) { if (isset($_FILES[$prefix . 'file'])) { //echo 'uploading file'; $upload_result = AR_UploadImage('file', $upload_dir, array(960, 960), $prefix, $_data[$prefix . 'file']); if (!$upload_result[0]) { $message = $upload_result[1]; } else { if ($upload_result[1] != $_data[$prefix . 'file']) { $obj->setFieldValues($prefix . "file", $upload_result[1]); $id = $obj->update($id); } } } $message = $module_Title . " Added Successfully"; } else { $message = $module_Title . " Not Added !"; } #$_resource=$obj->getByID($_POST[$_id]); #$_data=$obj->Fetch($_resource);
public function edit($sid, $username) { //var_dump( $username);die(); if ($this->current_right < $this->fieldValues['user_right']) { return false; } $this->id = $sid; $this->select('*'); //$this->from($this->tbl); $where = array("uin" => $this->id, 'user_login' => $username, 'user_right <=' => $this->current_right); $this->where($where); $query = $this->get($this->tbl); //echo 'i am here'; $datarow = $query->row(0); if ($datarow->user_login != $this->fieldValues['user_login']) { return false; } //var_dump($datarow);die(); $data = array(); /*$this->where(array()); $where = array("uin"=>$this->id);*/ $this->where($where); //var_dump($this);die(); if ($this->fieldValues['user_pass'] == '') { $this->fieldValues['user_pass'] = $datarow->user_pass; } //var_dump($this->field_values);die(); foreach ($this->fields as $field) { $data[$field] = $this->fieldValues[$field]; } $result = $this->update($this->tbl, $data); if ($result) { if (isset($_FILES['file'])) { //echo 'uploading file'; $upload_result = AR_UploadImage('file', $upload_dir, array(960, 960), $prefix, $_data[$prefix . 'file'], '', '', 1); //var_dump($upload_result); if (!$upload_result[0]) { $message = $upload_result[1]; } else { if ($upload_result[1] != $_data[$prefix . 'file']) { $obj->setFieldValues("file", $upload_result[1]); $id = $obj->update($_POST['uin']); } } } } //var_dump($result);die(); return $result; }