| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263 |
- <?php
- class admin_services_model extends Model {
- public function getBoxes() {
- $result = $this->query("select * from azonics_services where box_status<>'0';");
- return $result;
- }
-
-
- public function loadBox() {
- $box_id = $this->escapeString($_REQUEST['id']);
- $row = $this->query("select * from azonics_services where box_id='".$box_id."';");
- return $row[0];
- }
-
-
- public function saveBox() {
- $data = $this->escapeArray($_REQUEST);
-
- if ($data['box_id']!='') {
- if ($_FILES['box_banner']['tmp_name']!=='') {
- $fname = 'banner_'.time().'.jpg';
- $path = 'static/uploads/thumbs/';
- move_uploaded_file($_FILES['box_banner']['tmp_name'],$path.$fname);
- $this->execute("UPDATE azonics_services SET box_banner='".$path.$fname."' WHERE box_id='".$data['box_id']."';");
- }
- $this->execute("update azonics_services set "
- . "box_title='".$data['box_title']."', "
- . "box_subtitle='".$data['box_subtitle']."', box_subtitle_en='".$data['box_subtitle_en']."', box_button_text='".$data['box_button_text']."', box_button_text_en='".$data['box_button_text_en']."', parent_service='".$data['parent_service']."' "
- . "where box_id='".$data['box_id']."';");
-
- return true;
- }
- else {
- if ($_FILES['box_banner']['tmp_name']!=='') {
- $fname = 'banner_'.time().'.jpg';
- $path = 'static/uploads/thumbs/';
- move_uploaded_file($_FILES['box_banner']['tmp_name'],$path.$fname);
- }
- $this->execute("insert into azonics_services set "
- . "box_slug='".$data['box_slug']."', "
- . "box_title='".$data['box_title']."', "
- . "box_subtitle='".$data['box_subtitle']."', "
- . "box_subtitle_en='".$data['box_subtitle_en']."', "
- . "box_button_text='".$data['box_button_text']."', "
- . "box_button_text_en='".$data['box_button_text_en']."', "
- . "box_status='1', box_banner='".$path.$fname."', "
- . "box_user='".$_SESSION['admin_user']->admin_id."', parent_service='".$data['parent_service']."';");
- return true;
- }
- }
-
-
- public function deleteBox() {
- $box_id = $this->escapeString($_REQUEST['id']);
- $this->execute("update azonics_services set box_status='0' where box_id='".$box_id."';");
- return true;
- }
-
- }
|