public function actionAddDoctor() { $attr = StringHelper::filterArrayString($_POST); $model = new Doctors(); $model->setAttributes($attr); $model->created_at = time(); $model->updated_at = time(); if ($model->save(FALSE)) { ResponseHelper::JsonReturnSuccess("", "Success"); } else { ResponseHelper::JsonReturnError("", "Server Error"); } }
public function searchByAddressAndKeywords($province, $district, $ward, $limit, $offset, $keywords) { $criteria = new CDbCriteria(); if (!empty($province)) { $criteria->addCondition("province={$province}"); } if (!empty($ward)) { $criteria->addCondition("ward={$ward}"); } if (!empty($district)) { $criteria->addCondition("district={$district}"); } if (!empty($keywords)) { $criteria->addSearchCondition('name', $keywords, TRUE, 'OR', 'LIKE'); $criteria->addSearchCondition('address', $keywords, TRUE, 'OR', 'LIKE'); $criteria->addSearchCondition('contact_num', $keywords, TRUE, 'OR', 'LIKE'); } $criteria->limit = $limit; $criteria->offset = $offset; $data = Doctors::model()->findAll($criteria); $cnt = count($data); return array('cnt' => $cnt, 'data' => $data); }
</head> <body> <div id="header_bg_image"> <?php include_once "./partials/_navbar.php"; ?> </div> <div class="container page_section" id="team_list"> <div class="row title_box"> <div class="col-xs-12"> <h3 class="text_stand_out text-center">Incontra il nostro team</h3> </div> </div> <div class="section col-xs-12 col-md-offset-1 col-md-10"> <?php $doctors = new Doctors($db); $doctors->get_all(); foreach ($doctors->doctors as $doctor) { echo "<div class='row doctor'>"; echo "<div class='anchor' id='{$doctor->first_name}{$doctor->last_name}'></div>"; echo "<section class='col-xs-offset-2 col-sm-offset-0 col-xs-8 col-sm-6 col-md-3'>"; echo "<img class='img-thumbnail img-responsive' src='./images/doctors/{$doctor->image}'>"; echo "</section>"; echo "<section class='row infos col-xs-12 col-sm-6 col-md-9'>"; echo "<section class='col-xs-12'>"; echo "<h3><span class='fa fa-download fa'></span> <a href='./curricula/{$lang}/{$doctor->curriculum}' class='link'>"; if (strcmp($doctor->gender, 'M') == 0) { echo "Dr."; } else { echo "Dr. ssa"; }
public function actionGetTreatment() { if (!isset($_GET['q'])) { throw new CHttpException(401, 'Missing diagnosis name'); } $lat = @$_GET['lat']; $long = @$_GET['long']; $diagnosisName = @$_GET['q']; $data = array(); $diagnosis = Diagnosis::model()->findByAttributes(array('name' => $diagnosisName)); if (!$diagnosis) { throw new CHttpException(401, 'Invalid diagnosis name'); } $treatment = Treatment::model()->findByAttributes(array('diagnosis_id' => $diagnosis->id)); $data['action'] = $treatment->action; $diagnosisType = DiagnosisTypes::model()->findByAttributes(array('diagnosis_id' => $diagnosis->id)); $doctors = Doctors::model()->findAllByAttributes(array('type' => $diagnosisType->doctor_type_id)); //how to compute for nearest place for the doctor foreach ($doctors as $d) { $data['doctors'][] = array('id' => $d->id, 'name' => $d->getFullname(), 'address' => $d->address, 'type' => $diagnosisType->doctorType->name, 'contact_no' => $d->contact_no, 'schedule' => $d->schedule, 'other_info' => $d->other_info, 'lat' => $d->lat, 'long' => $d->long); } echo CJSON::encode($data); }
</div> </section> </div> </div> </div> <div id="team_bg_image"> <div class="container page_section" id="team"> <div class="anchor" id="team-a"></div> <div class="row title_box"> <div class="col-xs-12"> <h3 class="text_stand_out text-center"><span class="fa fa-arrow-circle-o-left fa-lg scroll_arrow left_scroll_arrow" data-id="#doct-scroll"></span>il team<span class=" fa fa-arrow-circle-o-right fa-lg scroll_arrow right_scroll_arrow" data-id="#doct-scroll"></span></h3> </div> </div> <div class="row h_scroll" id="doct-scroll"> <?php $doct = new Doctors($db); $doct->get_all(); foreach ($doct->doctors as $doctor) { echo "<section class='col-xs-6 col-sm-3 h_scroll_box'>"; echo "<img class='img-thumbnail img-responsive' src='./images/doctors/{$doctor->image}'>"; echo "<h5 class='text-capitalize h_scroll_text'><a class='link' href='./team.php#{$doctor->first_name}{$doctor->last_name}'>"; if (strcmp($doctor->gender, 'M') == 0) { echo "Dr."; } else { echo "Dr. ssa"; } echo " {$doctor->last_name} {$doctor->first_name}</a></h5>"; echo "</section>"; } ?> </div>
/** * Returns the data model based on the primary key given in the GET variable. * If the data model is not found, an HTTP exception will be raised. * @param integer $id the ID of the model to be loaded * @return Doctors the loaded model * @throws CHttpException */ public function loadModel($id) { $model = Doctors::model()->findByPk($id); if ($model === null) { throw new CHttpException(404, 'The requested page does not exist.'); } return $model; }
foreach ($ambulatories->ambulatories as $ambulatory) { if (!$ambulatories->active) { continue; } echo "<div class='row ambulatory'>"; echo "<section class='col-xs-12 col-sm-6 col-md-3' class='picture'>"; echo "<img class='img-thumbnail img-responsive' src='./images/ambulatories/small/{$ambulatory->image}'>"; echo "</section>"; echo "<section class='row infos col-xs-12 col-sm-6 col-md-9'>"; echo "<section class='col-xs-12'>"; echo "<h3>"; echo "<p>"; if ($ambulatory->acronim == 'CA') { echo "<a href='./ambulatory.php?ID={$ambulatory->id}'>"; } echo "{$ambulatory->name}"; if ($ambulatory->acronim == 'CA') { echo "</a>"; } echo "</p>"; echo "</h3>"; $doctors = new Doctors($db); $doctors->get_by_ambulatory($ambulatory->id); foreach ($doctors->doctors as $doctor) { echo " <span class='link h5'><a href='./team.php#{$doctor->first_name}{$doctor->last_name}'>{$doctor->first_name} {$doctor->last_name} |</a></span>"; } echo "</section>"; echo "<section class='col-xs-12 ellipsed_text' data-text_length='300'>" . $content_extractor->get_section(strtolower($ambulatory->acronim)) . "</section>"; echo "</section>"; echo "</div>"; }
public function actionGetNearDoctor() { try { $request = Yii::app()->request; $lat = StringHelper::filterString($request->getQuery('lat')); $lng = StringHelper::filterString($request->getQuery('lng')); $limit = StringHelper::filterString($request->getQuery('limit')); $offset = StringHelper::filterString($request->getQuery('offset')); $data = Doctors::model()->getNearDoctors($lat, $lng, $limit, $offset); ResponseHelper::JsonReturnSuccess($data, 'Success'); } catch (Exception $ex) { var_dump($ex->getMessage()); } }
<section class ="section col-xs-12 col-md-offset-1 col-md-8"> <?php include_once "./partials/_" . strtolower($department->acronim) . ".php"; ?> </section> <section class ="section col-xs-offset-4 col-xs-4 col-md-offset-0 col-md-2"> <div class="row"> <div class="title_box col-xs-12"> <h3 class="text_stand_out text-center"><?php echo "Medici"; ?> </h3> </div> <div class="col-xs-12"> <?php $doctors = new Doctors($db); $doctors->get_by_department($department->id); foreach ($doctors->doctors as $doctor) { echo "<section class='doctor_box'>"; echo "<img class='img-thumbnail img-responsive' src='./images/doctors/{$doctor->image}'>"; echo "<span class='text-capitalize h_scroll_text'><a href='./team.php#{$doctor->first_name}{$doctor->last_name}' class ='link'>"; if (strcmp($doctor->gender, 'M') == 0) { echo "Dr."; } else { echo "Dr. ssa"; } echo " {$doctor->last_name} {$doctor->first_name}</a></span>"; echo "</section>"; } ?> </div>
public function getNearDoctors($lat, $lng, $limit, $offset) { $retVal = array(); $criteria = new CDbCriteria(); if (!empty($lat) && !empty($lng)) { $criteria->select = "t.*, (2 * (3959 * ATAN2(\n SQRT(\n POWER(SIN((RADIANS(" . $lat . " - `t`.`lat` ) ) / 2 ), 2 ) +\n COS(RADIANS(`t`.`lat`)) *\n COS(RADIANS(" . $lat . ")) *\n POWER(SIN((RADIANS(" . $lng . " - `t`.`lng` ) ) / 2 ), 2 )\n ),\n SQRT(1-(\n POWER(SIN((RADIANS(" . $lat . " - `t`.`lat` ) ) / 2 ), 2 ) +\n COS(RADIANS(`t`.`lat`)) *\n COS(RADIANS(" . $lat . ")) *\n POWER(SIN((RADIANS(" . $lng . " - `t`.`lng` ) ) / 2 ), 2 )\n ))\n )\n )) as\n distance"; $criteria->having = 'distance < 3'; $criteria->group = 't.id'; } $criteria->order = 'distance ASC'; $criteria->limit = $limit; $criteria->offset = $offset; $data = Doctors::model()->findAll($criteria); $attrs = $this->attributeLabels(); foreach ($data as $item) { $itemArr = array(); foreach ($attrs as $key => $value) { $itemArr[$key] = $item->{$key}; } $itemArr['stars'] = Review::model()->sumRating($item->id, 1); $itemArr['reviews'] = Review::model()->countReview($item->id, 1); $retVal[] = $itemArr; } return $retVal; }