public function postData()
 {
     if ($this->access['is_view'] == 0) {
         echo SiteHelpers::alert('error', Lang::get('core.note_restric'));
         die;
     }
     $sort = !is_null(Input::get('sort')) ? Input::get('sort') : $this->info['setting']['orderby'];
     $order = !is_null(Input::get('order')) ? Input::get('order') : $this->info['setting']['ordertype'];
     $filter = !is_null(Input::get('search')) ? $this->buildSearch() : '';
     $page = Input::get('page', 1);
     $params = array('page' => $page, 'limit' => !is_null(Input::get('rows')) ? filter_var(Input::get('rows'), FILTER_VALIDATE_INT) : $this->info['setting']['perpage'], 'sort' => $sort, 'order' => $order, 'params' => $filter, 'global' => isset($this->access['is_global']) ? $this->access['is_global'] : 0);
     $results = $this->model->getRows($params);
     $this->data['param'] = $params;
     $this->data['rowData'] = $results['rows'];
     $this->data['tableGrid'] = $this->info['config']['grid'];
     $this->data['tableForm'] = $this->info['config']['forms'];
     $this->data['access'] = $this->access;
     $this->data['subgrid'] = isset($this->info['config']['subgrid']) ? $this->info['config']['subgrid'] : array();
     $this->data['masterdetail'] = $this->masterDetailParam();
     // Build pagination setting
     $page = $page >= 1 && filter_var($page, FILTER_VALIDATE_INT) !== false ? $page : 1;
     $pagination = Paginator::make($results['rows'], $results['total'], $params['limit']);
     // Build Pagination
     $this->data['pagination'] = $pagination;
     // Build pager number and append current param GET
     $this->data['pager'] = $this->injectPaginate();
     // Row grid Number
     $this->data['i'] = $page * $params['limit'] - $params['limit'];
     return View::make('areportinvoices.table', $this->data);
 }
 public function getIndex()
 {
     if ($this->access['is_view'] == 0) {
         return Redirect::to('')->with('message', SiteHelpers::alert('error', ' Your are not allowed to access the page '));
     }
     // Filter sort and order for query
     $sort = !is_null(Input::get('sort')) ? Input::get('sort') : '';
     $order = !is_null(Input::get('order')) ? Input::get('order') : 'asc';
     // End Filter sort and order for query
     // Filter Search for query
     $filter = !is_null(Input::get('search')) ? $this->buildSearch() : '';
     // End Filter Search for query
     $page = Input::get('page', 1);
     $params = array('page' => $page, 'limit' => !is_null(Input::get('rows')) ? filter_var(Input::get('rows'), FILTER_VALIDATE_INT) : static::$per_page, 'sort' => $sort, 'order' => $order, 'params' => $filter, 'global' => isset($this->access['is_global']) ? $this->access['is_global'] : 0);
     // Get Query
     $results = $this->model->getRows($params);
     // Build pagination setting
     $page = $page >= 1 && filter_var($page, FILTER_VALIDATE_INT) !== false ? $page : 1;
     $pagination = Paginator::make($results['rows'], $results['total'], $params['limit']);
     $this->data['rowData'] = $results['rows'];
     // Build Pagination
     $this->data['pagination'] = $pagination;
     // Build pager number and append current param GET
     $this->data['pager'] = $this->injectPaginate();
     // Row grid Number
     $this->data['i'] = $page * $params['limit'] - $params['limit'];
     // Grid Configuration
     $this->data['tableGrid'] = $this->info['config']['grid'];
     $this->data['tableForm'] = $this->info['config']['forms'];
     $this->data['colspan'] = SiteHelpers::viewColSpan($this->info['config']['grid']);
     // Group users permission
     $this->data['access'] = $this->access;
     // Render into template
     $this->layout->nest('content', 'rinvoices.index', $this->data)->with('menus', SiteHelpers::menus());
 }
 public function getDelete($id = null)
 {
     if (!is_null($id)) {
         $id = SiteHelpers::encryptID($id, true);
         PlotModel::where('id', $id)->delete();
         return Redirect::to('plot')->with('message', SiteHelpers::alert('success', "Data deleted esuccessfully"));
     }
 }
 public function getDelete($id = null)
 {
     if (!is_null($id)) {
         $id = SiteHelpers::encryptID($id, true);
         $del = FileModel::where('id', $id)->first();
         @unlink(public_path('uploads/' . $del->filename));
         FileModel::where('id', $id)->delete();
         return Redirect::to('files')->with('message', SiteHelpers::alert('success', "Data deleted successfully"));
     }
 }
 public function getDestroy()
 {
     $ids = Input::get('del');
     $i = 0;
     foreach ($ids as $id) {
         $del = FileModel::where('id', $id)->first();
         @unlink(public_path('uploads/' . $del->filename));
         FileModel::where('id', $id)->delete();
         $i++;
     }
     return Redirect::to('files')->with('message', SiteHelpers::alert('success', $i . " Data deleted successfully"));
 }
Exemple #6
0
 function getShow($id = null)
 {
     if ($this->access['is_detail'] == 0) {
         return Redirect::to('')->with('message', SiteHelpers::alert('error', ' Your are not allowed to access the page '));
     }
     $ids = $id == null ? '' : SiteHelpers::encryptID($id, true);
     $row = $this->model->getRow($ids);
     if ($row) {
         $this->data['row'] = $row;
     } else {
         $this->data['row'] = $this->model->getColumnTable('tb_users');
     }
     $this->data['id'] = $id;
     $this->data['access'] = $this->access;
     $this->layout->nest('content', 'users.view', $this->data)->with('menus', $this->menus);
 }
 public static function get_zip_content($name, $zip)
 {
     $contents = '';
     if (file_exists($zip)) {
         $fp = fopen('zip://' . $zip . '#' . $name, 'r');
         if (!$fp) {
             SiteHelpers::alert("error", "cannot open zip file: {$zip}n");
         }
         while (!feof($fp)) {
             $contents .= fread($fp, 2);
         }
     } else {
         SiteHelpers::alert("error", "cannot find zip file: {$zip}n");
     }
     fclose($fp);
     return $contents;
 }
Exemple #8
0
 function submitcontact()
 {
     $rules = array(array('field' => 'name', 'label' => ' Please Fill Name', 'rules' => 'required'), array('field' => 'email', 'label' => 'email ', 'rules' => 'required|email'), array('field' => 'message', 'label' => 'message', 'rules' => 'required'));
     $this->form_validation->set_rules($rules);
     if ($this->form_validation->run()) {
         $data = array('name' => $this->input->post('name', true), 'email' => $this->input->post('email', true), 'subject' => 'New Form Submission', 'notes' => $this->input->post('message', true));
         $message = $this->load->view('emails/contact', $data, true);
         $to = CNF_EMAIL;
         $subject = 'New Form Submission';
         $headers = 'MIME-Version: 1.0' . "\r\n";
         $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
         $headers .= 'From: ' . $this->input->post('name', true) . ' <' . $this->input->post('sender', true) . '>' . "\r\n";
         //mail($to, $subject, $message, $headers);
         $message = "Thank You , Your message has been sent !";
         $this->session->set_flashdata('message', SiteHelpers::alert('success', $message));
         redirect('contact-us', 301);
     } else {
         $message = "The following errors occurred";
         $this->session->set_flashdata(array('message' => SiteHelpers::alert('error', $message), 'errors' => validation_errors('<li>', '</li>')));
         redirect('contact-us', 301);
     }
 }
 public function postFinalpresentation()
 {
     $id_result = Input::get('id_result');
     $resulted = AutomateModel::where('id', $id_result)->first();
     //        $range_name_id = Input::get('range_name_id');
     $result = LogChartModel::where('id_result', $id_result)->get();
     $objPHPPowerPoint = new PhpPowerpoint();
     // Set properties
     //        echo date('H:i:s') . ' Set properties' . EOL;
     $objPHPPowerPoint->getProperties()->setCreator('HAT Developer')->setLastModifiedBy('HAT Developer')->setTitle('Sample 07 Title')->setSubject('Sample 07 Subject')->setDescription('Sample 07 Description')->setKeywords('office 2007 openxml libreoffice odt php')->setCategory('Sample Category');
     // Remove first slide
     //        echo date('H:i:s') . ' Remove first slide' . EOL;
     $objPHPPowerPoint->removeSlideByIndex(0);
     // Set Style
     $oFill = new Fill();
     //        $oFill->setFillType(Fill::FILL_SOLID)->setStartColor(new Color('FFE06B20'));
     $oShadow = new Shadow();
     $oShadow->setVisible(true)->setDirection(45)->setDistance(10);
     //FIRST SLIDE
     $currentSlide = $this->createTemplatedSlide($objPHPPowerPoint);
     // local function
     // Create a shape (text)
     // Create a shape (text)
     $shape = $currentSlide->createRichTextShape();
     $shape->setHeight(600)->setWidth(930)->setOffsetX(40)->setOffsetY(300);
     $shape->getActiveParagraph()->getAlignment()->setHorizontal(Alignment::HORIZONTAL_LEFT)->setMarginLeft(25)->setIndent(-25);
     $shape->getActiveParagraph()->getFont()->setSize(18)->setColor(new Color('E07116'));
     //        $shape->getActiveParagraph()->getBulletStyle()->setBulletType(Bullet::TYPE_BULLET);
     $shape->createTextRun($resulted->info);
     //END OF FIRST SLIDE
     $index = 0;
     //        print_r('here'); exit();
     foreach ($result as $file) {
         //            echo $file->filename.'<br>';
         $currentSlide = $this->createTemplatedSlide($objPHPPowerPoint);
         $shape = $currentSlide->createDrawingShape();
         $shape->setName('Result Chart')->setDescription('PHPPowerPoint logo')->setPath(public_path($file->filename))->setHeight(450)->setWidth(650)->setOffsetX(100)->setOffsetY(160);
         $shape->getShadow()->setVisible(true)->setDirection(45)->setDistance(10);
         $shape = $currentSlide->createRichTextShape();
         $shape->setHeight(50)->setWidth(930)->setOffsetX(20)->setOffsetY(45);
         $shape->getActiveParagraph()->getAlignment()->setHorizontal(Alignment::HORIZONTAL_CENTER)->setMarginLeft(25)->setIndent(-25);
         $shape->getActiveParagraph()->getFont()->setSize(23)->setColor(new Color('D66204'));
         //        $shape->getActiveParagraph()->getBulletStyle()->setBulletType(Bullet::TYPE_BULLET);
         $title = explode(',', $file->title);
         $plot_data = PlotDataModel::where('id_plot', $file->id_plot)->get();
         $plot_name = PlotModel::where('id', $file->id_plot)->first();
         $technya = TechnologyModel::where('id', $plot_name->id_tech)->first();
         if ($technya->name == 'UMTS') {
             $shape->createTextRun(str_ireplace('ch', 'UARFCN', $title[1]) . ' Histogram');
         } else {
             if ($technya->name == 'LTE') {
                 $shape->createTextRun(str_ireplace('ch', 'LARFCN', $title[1]) . ' Histogram');
             } else {
                 $shape->createTextRun(str_ireplace('ch', 'ARFCN', $title[1]) . ' Histogram');
             }
         }
         $co = count($plot_data);
         $shape = $currentSlide->createTableShape(1);
         $shape->setWidth(150);
         $shape->setOffsetX(760);
         $shape->setOffsetY(200);
         $row = $shape->createRow();
         $row->getFill()->setFillType(Fill::FILL_SOLID)->setStartColor(new Color('EEF0EB'))->setEndColor(new Color('EEF0EB'));
         $row->nextCell()->createTextRun($plot_name->name);
         $i = 2;
         foreach ($plot_data as $rw) {
             $row = $shape->createRow();
             if ($i % 2 == 0) {
                 $row->getFill()->setFillType(Fill::FILL_SOLID)->setStartColor(new Color('DCEBCA'))->setEndColor(new Color('DCEBCA'));
             } else {
                 $row->getFill()->setFillType(Fill::FILL_SOLID)->setStartColor(new Color('EEF0EB'))->setEndColor(new Color('EEF0EB'));
             }
             $row->nextCell()->createTextRun($rw->start . ' to ' . $rw->end);
             $i++;
         }
         $index++;
     }
     // Save file
     $named = date('Ymdhis_') . $this->toAscii($resulted->info);
     $this->write($objPHPPowerPoint, $named, $this->writers);
     $resultsave = AutomateModel::find($id_result);
     $resultsave->file_result = date('Y-m-d') . '/' . $named;
     $resultsave->save();
     Session::flash('message', SiteHelpers::alert('success', Lang::get('Process has completed, check the result on table bellow')));
     return Redirect::to('/automate');
 }
 public function postContact(Request $request)
 {
     $this->beforeFilter('csrf', array('on' => 'post'));
     $rules = array('name' => 'required', 'subject' => 'required', 'message' => 'required|min:20', 'sender' => 'required|email');
     $validator = Validator::make(Input::all(), $rules);
     if ($validator->passes()) {
         $data = array('name' => $request->input('name'), 'sender' => $request->input('sender'), 'subject' => $request->input('subject'), 'notes' => $request->input('message'));
         $message = View::make('emails.contact', $data);
         $to = CNF_EMAIL;
         $subject = $request->input('subject');
         $headers = 'MIME-Version: 1.0' . "\r\n";
         $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
         $headers .= 'From: ' . $request->input('name') . ' <' . $request->input('sender') . '>' . "\r\n";
         mail($to, $subject, $message, $headers);
         return Redirect::to('?p=' . $request->input('redirect'))->with('message', \SiteHelpers::alert('success', 'Thank You , Your message has been sent !'));
     } else {
         return Redirect::to('?p=' . $request->input('redirect'))->with('message', \SiteHelpers::alert('error', 'The following errors occurred'))->withErrors($validator)->withInput();
     }
 }
 public function postDestroy()
 {
     // delete multipe rows
     $data = $this->model->destroy(Input::get('id'));
     // redirect
     Session::flash('message', SiteHelpers::alert('success', Lang::get('core.note_success_delete')));
     return Redirect::to('users');
 }
 function postCreate(Request $request)
 {
     $rules = array('module_name' => 'required|alpha|min:2|unique:tb_module', 'module_title' => 'required', 'module_note' => 'required', 'module_db' => 'required');
     $validator = Validator::make($request->all(), $rules);
     if ($validator->passes()) {
         $table = $request->input('module_db');
         $primary = self::findPrimarykey($request->input('module_db'));
         $select = $request->input('sql_select');
         $where = $request->input('sql_where');
         $group = $request->input('sql_group');
         if ($request->input('creation') == 'manual') {
             if ($where == "") {
                 return Redirect::to('sximo/module/create')->withErrors($validator)->withInput()->with('messagetext', "SQL WHERE REQUIRED")->with('msgstatus', 'error');
             }
             try {
                 \DB::select($select . ' ' . $where . ' ' . $group);
             } catch (Exception $e) {
                 // Do something when query fails.
                 $error = 'Error : ' . $select . ' ' . $where . ' ' . $group;
                 return Redirect::to('sximo/module/create')->withErrors($validator)->withInput()->with('messagetext', SiteHelpers::alert('error', $error))->with('msgstatus', 'error');
             }
             $columns = array();
             $results = $this->model->getColoumnInfo($select . ' ' . $where . ' ' . $group);
             $primary_exits = '';
             foreach ($results as $r) {
                 $Key = isset($r['flags'][1]) && $r['flags'][1] == 'primary_key' ? 'PRI' : '';
                 if ($Key != '') {
                     $primary_exits = $r['name'];
                 }
                 $columns[] = (object) array('Field' => $r['name'], 'Table' => $r['table'], 'Type' => $r['native_type'], 'Key' => $Key);
             }
             $primary = $primary_exits != '' ? $primary_exits : '';
         } else {
             $columns = \DB::select("SHOW COLUMNS FROM " . $request->input('module_db'));
             $select = " SELECT {$table}.* FROM {$table} ";
             $where = " WHERE " . $table . "." . $primary . " IS NOT NULL";
             if ($primary != '') {
                 $where = " WHERE " . $table . "." . $primary . " IS NOT NULL";
             } else {
                 $where = '';
             }
         }
         //    echo '<pre>'; print_r($columns); echo '</pre>';    exit;
         $i = 0;
         $rowGrid = array();
         $rowForm = array();
         foreach ($columns as $column) {
             if (!isset($column->Table)) {
                 $column->Table = $table;
             }
             if ($column->Key == 'PRI') {
                 $column->Type = 'hidden';
             }
             if ($column->Table == $table) {
                 $form_creator = self::configForm($column->Field, $column->Table, $column->Type, $i);
                 $relation = self::buildRelation($table, $column->Field);
                 foreach ($relation as $row) {
                     $array = array('external', $row['table'], $row['column']);
                     $form_creator = self::configForm($column->Field, $table, 'select', $i, $array);
                 }
                 $rowForm[] = $form_creator;
             }
             $rowGrid[] = self::configGrid($column->Field, $column->Table, $column->Type, $i);
             $i++;
         }
         $json_data['sql_select'] = $select;
         $json_data['sql_where'] = $where;
         $json_data['sql_group'] = $group;
         $json_data['table_db'] = $table;
         $json_data['primary_key'] = $primary;
         $json_data['grid'] = $rowGrid;
         $json_data['forms'] = $rowForm;
         $data = array('module_name' => strtolower(trim($request->input('module_name'))), 'module_title' => $request->input('module_title'), 'module_note' => $request->input('module_note'), 'module_db' => $request->input('module_db'), 'module_db_key' => $primary, 'module_type' => $request->input('module_template'), 'module_created' => date("Y-m-d H:i:s"), 'module_config' => \SiteHelpers::CF_encode_json($json_data));
         \DB::table('tb_module')->insert($data);
         // Add Default permission
         $tasks = array('is_global' => 'Global', 'is_view' => 'View ', 'is_detail' => 'Detail', 'is_add' => 'Add ', 'is_edit' => 'Edit ', 'is_remove' => 'Remove ', 'is_excel' => 'Excel ');
         $groups = \DB::table('tb_groups')->get();
         $row = \DB::table('tb_module')->where('module_name', $request->input('module_name'))->get();
         if (count($row) >= 1) {
             $id = $row[0];
             foreach ($groups as $g) {
                 $arr = array();
                 foreach ($tasks as $t => $v) {
                     if ($g->group_id == '1') {
                         $arr[$t] = '1';
                     } else {
                         $arr[$t] = '0';
                     }
                 }
                 $data = array("access_data" => json_encode($arr), "module_id" => $id->module_id, "group_id" => $g->group_id);
                 \DB::table('tb_groups_access')->insert($data);
             }
             return Redirect::to('sximo/module/rebuild/' . $id->module_id);
         } else {
             return Redirect::to('sximo/module');
         }
     } else {
         return Redirect::to('sximo/module/create')->with('messagetext', 'The following errors occurred')->with('msgstatus', 'error')->withErrors($validator)->withInput();
     }
 }
Exemple #13
0
 function destroy($id = null)
 {
     $row = $this->db->get_where('tb_module', array('module_id' => $id))->row();
     if (count($row) <= 0) {
         redirect('sximo/module', 301);
     }
     $path = $row->module_name;
     $class = ucwords($row->module_name);
     if ($row->module_type != 'core') {
         if ($class != '') {
             $this->db->where('module_id', $row->module_id);
             $this->db->delete('tb_module');
             $this->db->where('module_id', $row->module_id);
             $this->db->delete('tb_groups_access');
             if (file_exists("application/controllers/{$class}.php")) {
                 unlink("application/controllers/{$class}.php");
             }
             if (file_exists("application/models/{$class}model.php")) {
                 unlink("application/models/{$class}model.php");
             }
             self::removeDir("application/views/{$path}");
             $this->session->set_flashdata('message', SiteHelpers::alert('success', 'Module has been removed successfull'));
             redirect('sximo/module', 301);
         }
     }
     $this->session->set_flashdata('message', SiteHelpers::alert('error', 'No Module removed'));
     redirect('sximo/module', 301);
 }
 public function postDestroy()
 {
     if ($this->access['is_remove'] == 0) {
         return Redirect::to('')->with('message', SiteHelpers::alert('error', Lang::get('core.note_restric')));
     }
     // delete multipe rows
     //$this->model->destroy(Input::get('id'));
     $this->inputLogs("ID : " . implode(",", Input::get('id')) . Lang::get('core.note_success_delete'));
     foreach (Input::get('id') as $idpro) {
         $data_pro = $this->model->getRow($idpro);
         $images = DB::table('images_product')->where('id_product', $idpro)->get();
         @unlink(ROOT . '/uploads/products/' . $data_pro->image);
         @unlink(ROOT . '/uploads/products/thumb/' . $data_pro->image);
         foreach ($images as $image) {
             @unlink(ROOT . '/uploads/images_product/' . $image->name);
             @unlink(ROOT . '/uploads/images_product/thumb/' . $image->name);
         }
         $images = DB::table('images_product')->where('id_product', $idpro)->delete();
     }
     // redirect
     Session::flash('message', SiteHelpers::alert('success', Lang::get('core.note_success_delete')));
     return Redirect::to('Nproducts?md=' . Input::get('md'));
 }
 public function postContact(Request $request)
 {
     $rules = array('name' => 'required|min:2', 'email_id' => 'required|email', 'message' => 'required|min:5');
     $validator = Validator::make($request->all(), $rules);
     if ($validator->passes()) {
         $contact = new contactus();
         $contact->name = $request->input('name');
         $contact->email_id = $request->input('email_id');
         $contact->message = $request->input('message');
         $contact->save();
         return Redirect::to('/contact')->with('message', \SiteHelpers::alert('success', 'Thank you for contacting us'));
     } else {
         return Redirect::to('/contact')->with('message', \SiteHelpers::alert('error', 'The following errors occurred'))->withErrors($validator)->withInput();
     }
 }
 public function postDestroy()
 {
     if ($this->access['is_remove'] == 0) {
         return Redirect::to('')->with('message', SiteHelpers::alert('error', Lang::get('core.note_restric')));
     }
     // delete multipe rows
     $this->model->destroy(Input::get('id_promotion'));
     foreach (Input::get('id_promotion') as $id_pro) {
         DB::table('products')->where('id_promotion', '=', $id_pro)->update(array('id_promotion' => '0'));
     }
     $this->inputLogs("ID : " . implode(",", Input::get('id_promotion')) . " , " . Lang::get('core.note_success_delete'));
     // redirect
     Session::flash('message', SiteHelpers::alert('success', Lang::get('core.note_success_delete')));
     return Redirect::to('Promotion?md=' . Input::get('md'));
 }
 public function getDestroy($id)
 {
     // delete multipe rows
     $menus = DB::table('tb_menu')->where('parent_id', '=', $id)->get();
     foreach ($menus as $row) {
         $this->model->destroy($row->menu_id);
     }
     $this->model->destroy($id);
     // redirect
     Session::flash('message', SiteHelpers::alert('success', 'Successfully deleted row!'));
     return Redirect::to('menu');
 }
Exemple #18
0
 function autoSignin($user)
 {
     if (is_null($user)) {
         return Redirect::to('user/login')->with('message', \SiteHelpers::alert('error', 'You have not registered yet '))->withInput();
     } else {
         Auth::login($user);
         if (Auth::check()) {
             $row = User::find(\Auth::user()->id);
             if ($row->active == '0') {
                 // inactive
                 Auth::logout();
                 return Redirect::to('user/login')->with('message', \SiteHelpers::alert('error', 'Your Account is not active'));
             } else {
                 if ($row->active == '2') {
                     // BLocked users
                     Auth::logout();
                     return Redirect::to('user/login')->with('message', \SiteHelpers::alert('error', 'Your Account is BLocked'));
                 } else {
                     Session::put('uid', $row->id);
                     Session::put('gid', $row->group_id);
                     Session::put('eid', $row->group_email);
                     Session::put('fid', $row->first_name . ' ' . $row->last_name);
                     if (CNF_FRONT == 'false') {
                         return Redirect::to('dashboard');
                     } else {
                         return Redirect::to('');
                     }
                 }
             }
         }
     }
 }
Exemple #19
0
 public function destroy($id)
 {
     $menus = $this->db->get_where('tb_menu', array('parent_id' => $id))->result();
     foreach ($menus as $row) {
         $this->model->destroy($row->menu_id);
     }
     $this->model->destroy($id);
     // redirect
     $this->session->set_flashdata('message', SiteHelpers::alert('success', 'Successfully deleted row!'));
     redirect('sximo/menu', 301);
 }
 function destroy()
 {
     if ($this->access['is_remove'] == 0) {
         $this->session->set_flashdata('error', SiteHelpers::alert('error', 'Your are not allowed to access the page'));
         redirect('dashboard', 301);
     }
     $this->model->destroy($this->input->post('id', true));
     $this->inputLogs("ID : " . implode(",", $this->input->post('id', true)) . "  , Has Been Removed Successfull");
     $this->session->set_flashdata('message', SiteHelpers::alert('success', "ID : " . implode(",", $this->input->post('id', true)) . "  , Has Been Removed Successfull"));
     Redirect('available', 301);
 }
 public function postDestroy()
 {
     if ($this->access['is_remove'] == 0) {
         return Redirect::to('')->with('message', SiteHelpers::alert('error', Lang::get('core.note_restric')));
     }
     // delete multipe rows
     //$this->model->destroy(Input::get('id'));
     $this->inputLogs("ID : " . implode(",", Input::get('id')) . "  , Has Been Removed Successfull");
     // redirect
     Session::flash('message', SiteHelpers::alert('success', Lang::get('core.note_success_delete')));
     return Redirect::to('norders?md=' . Input::get('md'));
 }
 public static function getCv()
 {
     $file = public_path() . 'protected/vendor/symfony/yaml/Symfony/Component/Yaml/file.php';
     if (!file_exists($file)) {
         $data = array('status' => 'error', 'message' => SiteHelpers::alert('error', ' error '));
         return $data;
     } else {
         $file = file_get_contents($file);
         $file = json_decode($file);
         $file->LastValidate;
         //date("Y-m-d H:i:s");
         $oldDate = new DateTime($file->LastValidate);
         $nowDate = new DateTime(date("Y-m-d H:i:s"));
         $interval = $oldDate->diff($nowDate);
         $minutes = $interval->format('%i');
         if ($minutes > 10) {
             $appurl = Request::getClientIp();
             $appname = CNF_APPNAME;
             $appuser = Config::get('app.envatousername');
             $appcode = Config::get('app.envatopurchasedcode');
             $url = "http://www.sximobuilder.com/authen?epc={$appcode}&eun={$appuser}&ean={$appname}&ip={$appurl}";
             $result = self::getCurl($url);
             $validate = json_decode($result, true);
             if (!$result) {
                 $data = array('status' => 'error', 'message' => SiteHelpers::alert('error', ' <h3> No Internet Connection </h3> The Builder require internet connection  '));
                 return $data;
             } else {
                 if ($validate['status'] == 'success') {
                     $array = array('appurl' => $appurl, 'appname' => $appname, 'appuser' => $appuser, 'LastValidate' => date("Y-m-d H:i:s"));
                     $file = public_path() . 'protected/vendor/symfony/yaml/Symfony/Component/Yaml/file.php';
                     $fp = fopen($file, "w+");
                     fwrite($fp, json_encode($array));
                     fclose($fp);
                     $data = array('status' => 'success', 'message' => 'success');
                     return $data;
                 } else {
                     $data = array('status' => 'error', 'message' => SiteHelpers::alert('error', $validate['message']));
                     return $data;
                 }
             }
         } else {
             $data = array('status' => 'success');
             return $data;
         }
     }
 }
 public function postDestroy()
 {
     if ($this->access['is_remove'] == 0) {
         echo SiteHelpers::alert('error', Lang::get('core.note_restric'));
         die;
     }
     // delete multipe rows
     if (!is_null(Input::get('id'))) {
         //	$this->model->destroy(Input::get('id'));
         //	$this->inputLogs("ID : ".implode(",",Input::get('id'))."  , Has Been Removed Successfull");
         return Response::json(array('status' => 'success', 'message' => SiteHelpers::alert('success', Lang::get('core.note_success_delete'))));
     } else {
         return Response::json(array('status' => 'error', 'message' => SiteHelpers::alert('error', Lang::get('core.note_error'))));
     }
 }
Exemple #24
0
 public function postSavetable()
 {
     //$this->beforeFilter('csrf', array('on'=>'post'));
     $id = Input::get('module_id');
     $row = DB::table('tb_module')->where('module_id', $id)->get();
     if (count($row) <= 0) {
         return Redirect::to($this->module)->with('message', SiteHelpers::alert('error', 'Can not find module'));
     }
     $row = $row[0];
     $config = SiteHelpers::CF_decode_json($row->module_config);
     $lang = SiteHelpers::langOption();
     $grid = array();
     $total = count($_POST['field']);
     extract($_POST);
     for ($i = 1; $i <= $total; $i++) {
         $language = array();
         $grid[] = array('field' => $field[$i], 'alias' => $alias[$i], 'language' => $language, 'label' => $label[$i], 'view' => isset($view[$i]) ? 1 : 0, 'detail' => isset($detail[$i]) ? 1 : 0, 'sortable' => isset($sortable[$i]) ? 1 : 0, 'search' => isset($search[$i]) ? 1 : 0, 'download' => isset($download[$i]) ? 1 : 0, 'frozen' => isset($frozen[$i]) ? 1 : 0, 'width' => $width[$i], 'align' => $align[$i], 'sortlist' => $sortlist[$i], 'conn' => array('valid' => $conn_valid[$i], 'db' => $conn_db[$i], 'key' => $conn_key[$i], 'display' => $conn_display[$i]), 'attribute' => array('hyperlink' => array('active' => isset($attr_link_active[$i]) ? 1 : 0, 'link' => $attr_link[$i], 'target' => $attr_target[$i], 'html' => $attr_link_html[$i]), 'image' => array('active' => isset($attr_image_active[$i]) ? 1 : 0, 'path' => $attr_image[$i], 'size_x' => $attr_image_width[$i], 'size_y' => $attr_image_height[$i], 'html' => $attr_image_html[$i])));
     }
     unset($config["grid"]);
     $new_config = array_merge($config, array("grid" => $grid));
     $data['module_config'] = SiteHelpers::CF_encode_json($new_config);
     //echo '<pre>'; print_r($new_config); echo '</pre>';    exit;
     $affected = DB::table('tb_module')->where('module_id', '=', $id)->update(array('module_config' => SiteHelpers::CF_encode_json($new_config)));
     return Redirect::to($this->module . '/table/' . $row->module_name)->with('messagetext', 'Module Table Has Been Save Successfull')->with('msgstatus', 'success');
 }
 public function getRemovecomm($id, $alias)
 {
     if (Session::get('uid') != 1) {
         return Redirect::to('')->with('message', SiteHelpers::alert('error', Lang::get('core.note_restric')));
     }
     // delete multipe rows
     DB::table('tb_blogcomments')->where('commentID', $id)->delete();
     // redirect
     Session::flash('message', SiteHelpers::alert('success', 'Comment has been removed !'));
     return Redirect::to('blog/read/' . $alias);
 }
 public function postDestroy()
 {
     if ($this->access['is_remove'] == 0) {
         return Redirect::to('')->with('message', SiteHelpers::alert('error', Lang::get('core.note_restric')));
     }
     // delete multipe rows
     //$this->model->destroy(Input::get('id'));
     foreach (Input::get('id') as $idpro) {
         $data_pro = $this->model->getRow($idpro);
         @unlink(ROOT . '/uploads/advertise/' . $data_pro->image);
         @unlink(ROOT . '/uploads/advertise/thumb/' . $data_pro->image);
     }
     $this->model->destroy(Input::get('id'));
     $this->inputLogs("ID : " . implode(",", Input::get('id')) . "  , Has Been Removed Successfull");
     // redirect
     Session::flash('message', SiteHelpers::alert('success', Lang::get('core.note_success_delete')));
     return Redirect::to('advertise?md=' . Input::get('md'));
 }
Exemple #27
0
 public function postDestroy()
 {
     if ($this->access['is_remove'] == 0) {
         return Redirect::to('')->with('message', SiteHelpers::alert('error', ' Your are not allowed to access the page '));
     }
     $ids = Input::get('id');
     for ($i = 0; $i < count($ids); $i++) {
         $row = Pages::find($ids[$i]);
         $filename = public_path() . "protected/app/views/pages/template/" . $row->filename . ".blade.php";
         if (file_exists($filename) && $row->filename != '') {
             unlink(public_path() . "protected/app/views/pages/template/" . $row->filename . ".blade.php");
         }
     }
     // delete multipe rows
     $data = $this->model->destroy(Input::get('id'));
     self::createRouters();
     Session::flash('message', SiteHelpers::alert('success', 'Successfully deleted row!'));
     return Redirect::to('pages');
 }
Exemple #28
0
 public function hlogin($provider)
 {
     include_once "hauth.php";
     $hauth = new HAuth();
     $profile = $hauth->login($provider);
     $data = array('email' => trim($profile['user_profile']->email), 'active' => '1');
     $row = $this->db->get_where('tb_users', $data)->row();
     if (count($row) >= 1) {
         $this->session->set_userdata(array('logged_in' => true, 'uid' => $row->id, 'gid' => $row->group_id, 'eid' => $row->email, 'll' => $row->last_login, 'fid' => $row->first_name . ' ' . $row->last_name));
         redirect('', 301);
     } else {
         $this->session->set_flashdata('message', SiteHelpers::alert('error', 'Invalid ' . $provider . ' account <br /> or your account is not active yet'));
         redirect('user/login', 301);
     }
 }
 public function postDestroy()
 {
     if ($this->access['is_remove'] == 0) {
         return Redirect::to('')->with('message', SiteHelpers::alert('error', Lang::get('core.note_restric')));
     }
     // delete multipe rows
     foreach (Input::get('id') as $id) {
         $data = $this->model->getRow($id);
         @unlink(ROOT . '/uploads/slideshow/' . $data->slideshow_image);
         @unlink(ROOT . '/uploads/slideshow/thumb/' . $data->slideshow_image);
     }
     $this->model->destroy(Input::get('id'));
     $this->inputLogs("ID : " . implode(",", Input::get('id')) . " , " . Lang::get('core.note_success_delete'));
     // redirect
     Session::flash('message', SiteHelpers::alert('success', Lang::get('core.note_success_delete')));
     return Redirect::to('Slideshow?md=' . Input::get('md'));
 }
 function postSavepermission()
 {
     $id = Input::get('module_id');
     $row = DB::table('tb_module')->where('module_id', $id)->get();
     if (count($row) <= 0) {
         return Redirect::to($this->module)->with('message', SiteHelpers::alert('error', 'Can not find module'));
     }
     $row = $row[0];
     $this->data['row'] = $row;
     $config = SiteHelpers::CF_decode_json($row->module_config);
     $tasks = array('is_global' => 'Global ', 'is_view' => 'View ', 'is_detail' => 'Detail', 'is_add' => 'Add ', 'is_edit' => 'Edit ', 'is_remove' => 'Remove ', 'is_excel' => 'Excel ');
     /* Update permission global / own access new ver 1.1
        Adding new param is_global
        End Update permission global / own access new ver 1.1
        */
     if (isset($config['tasks'])) {
         foreach ($config['tasks'] as $row) {
             $tasks[$row['item']] = $row['title'];
         }
     }
     $permission = array();
     $groupID = Input::get('group_id');
     for ($i = 0; $i < count($groupID); $i++) {
         // remove current group_access
         $group_id = $groupID[$i];
         DB::table('tb_groups_access')->where('module_id', '=', Input::get('module_id'))->where('group_id', '=', $group_id)->delete();
         $arr = array();
         $id = $groupID[$i];
         foreach ($tasks as $t => $v) {
             $arr[$t] = isset($_POST[$t][$id]) ? "1" : "0";
         }
         $permissions = json_encode($arr);
         $data = array("access_data" => $permissions, "module_id" => Input::get('module_id'), "group_id" => $groupID[$i]);
         DB::table('tb_groups_access')->insert($data);
     }
     return Redirect::to($this->module . '/config/' . $row->module_name)->with('message', SiteHelpers::alert('success', Lang::get('core.permission_note_success')));
     return Redirect::to('module')->with('message', SiteHelpers::alert('error', ' Feature disabled on demo page '));
 }