public function oneAction() { $query = Criteria::fromInput($this->di, "Educations", array_merge($_GET, $_POST)); $this->persistent->parameters = $query->getParams(); $parameters = $this->persistent->parameters; if (!is_array($parameters)) { $parameters = array(); } $data = \Educations::findFirst($parameters)->toArray(true); $this->view->disable(); $this->response->setContentType('application/json', 'UTF-8'); echo json_encode($data); }
public function editAction($id = NULL) { $this->view->title = "Редагувати студента"; $this->view->nothing = true; $this->view->ind_code = $this->request->get("ind_code"); if (!is_null($this->view->ind_code) && $this->checkINN($this->view->ind_code) || !is_null($id)) { $this->view->nothing = false; $this->view->student = is_null($id) ? \Students::findFirst("ind_code = " . $this->view->ind_code) : \Students::findFirst($id); $this->view->user = $this->session->get("user"); $methodistBrands = \BrandsMethodists::find("user_id=" . $this->view->user->id)->toArray(); $methodistActivities = \ActivitiesMethodists::find("user_id=" . $this->view->user->id)->toArray(); if ($this->view->student != NULL) { $this->view->ind_code = $this->view->student->ind_code; $this->view->user = \Users::findFirst($this->view->student->user_id); $studentBrands = BrandsService::getStudentBrands($this->view->student); $studentActivities = ActivitiesService::getStudentActivities($this->view->student); $studentPostsJSON = array(); if ($this->view->student->StudentsPosts != NULL) { foreach ($this->view->student->StudentsPosts as $sp) { //{"dealer":"1","post":"2","brands":["2", "5"],"activities":["1"],"rate":"1.0","appoint_date":"2015-04-01"} $studentPostsJSON[$sp->id] = array(); $studentPostsJSON[$sp->id]["dealer"] = $sp->dealer; $studentPostsJSON[$sp->id]["post"] = $sp->post; $array = array(); foreach ($sp->StudentsPostsBrands as $spb) { $array[] = $spb->Brands->id; } $studentPostsJSON[$sp->id]["brands"] = $array; $array = array(); foreach ($sp->StudentsPostsActivities as $spa) { $array[] = $spa->Activities->id; } $studentPostsJSON[$sp->id]["activities"] = $array; $studentPostsJSON[$sp->id]["rate"] = $sp->rate; $studentPostsJSON[$sp->id]["appoint_date"] = $sp->appoint_date; } } //$this->view->student->StudentsEducation; } else { $this->view->student = new \Students(); $this->view->user = new \Users(); $studentPostsJSON = array(); $studentBrands = array(); $studentActivities = array(); } $this->view->brands = BrandsService::getForChosenEntity(\Brands::find()->toArray(), $methodistBrands, $studentBrands); $this->view->activities = ActivitiesService::getForChosenEntity(\Activities::find()->toArray(), $methodistActivities, $studentActivities); $this->view->allEducations = \Educations::find("parent_id is NULL"); $this->view->allDealers = \Dealers::find(); $this->view->studentPostsJSON = $studentPostsJSON; } }
<?php /** * Created by PhpStorm. * User: ekobudisusilo * Date: 04 /07 /15 * Time: 19.37 */ ob_start(); include 'class.Educations.php'; $jenjang = htmlspecialchars($_POST['nama']); $isi = new Educations(); switch ($_GET['p']) { case "add": $isi->AddEducations($jenjang); header('location: ../main.php?m=141'); break; case "edit": $id = $_REQUEST['id']; $isi->EditEducations($jenjang, $id); header('location: ../main.php?m=141'); break; case "del": $id = $_REQUEST['id']; $isi->AddDelete($id); header('location: ../main.php?m=141'); break; //default: echo "Not Founds"; } ob_end_flush();
<?php /** * Created by PhpStorm. * User: ekobudisusilo * Date: 04 /07 /15 * Time: 20.24 */ ini_set('display_errors', 1); ini_set('display_startup_errors', 1); error_reporting(-1); include_once '/Applications/MAMP/htdocs/isias/classes/class.Educations.php'; include_once '/Applications/MAMP/htdocs/isias/classes/paginator.class.php'; $edu = new Educations(); $stmt = $edu->countAll(); $num_rows = $stmt->rowCount(); if ($num_rows > 0) { $pages = new Paginator($num_rows, 19); if (isset($_POST['cari'])) { $cari = $_POST['cari']; $stmt = $edu->GetListEducations($pages->limit_start, $pages->limit_end); } else { $stmt = $edu->GetListEducations($pages->limit_start, $pages->limit_end); } } ?> <div class="container"> <div class="row"> <a href="#myModal" role="button" class="btn btn-primary" data-toggle="modal" data-target="#add-Data">Pendidikan Baru</a> </div> </div>