public function action_index() { $view = View::factory('providerm'); $errors = array(); $where = ''; $post = array(); try { //-------------------------------------- //-------CREATE VALIDATION RULE IF ANY-------- $val = Validate::factory($_POST)->filter(TRUE, 'trim')->filter('id', 'trim')->filter('name', 'trim'); //------------END RULE------------------ //-------------------------------------- //------CREATE AN ARRAY OF POSTED DATA NEEDED----- if (isset($_POST['submit'])) { $post['name'] = Html::chars($_POST['name']); } //-------------END ACCEPTING POSTED DATA---------------------- if (isset($_REQUEST['id'])) { $where = Html::chars($_REQUEST['id']); } if (!isset($_POST["submit"])) { if ($where != '') { $post = $this->model->SelectById($where); if (!is_array($post)) { throw new Exception('Invalid data'); } } } elseif (isset($_POST['submit'])) { //------------CHECK FOR ANY VALIDATION RULE AND VALIDATE-------- if (!$val->check()) { $errors = $val->errors('event'); throw new Exception(''); } //------------NO PRO! LETS GO THERE-------- if ($where == '') { $this->model->save($post); } else { $post['id'] = $where; $this->model->update($post); } Cookie::set('msg', 'yes'); //------------REGISTRATION SUCESSFUL. WHAT NEXT-------- $this->request->redirect("provider/index"); } } catch (Exception $e) { //------------ERROR SELE. DISPLAY ERROR-------- $errors[] = $e->getMessage(); } $view->errors = $errors; $view->post = $post; //-------WHICH CAPTION SHOULD WE SHOW FOR OUR BUTTON. MULTILANGUAGE PLEASE-------- if ($where != '') { $view->btName = $this->message['update']; } else { $view->btName = $this->message['submit']; } //------------OUR PRESENTATION PLEASE!-------- $this->template->content = $view; }
public function get_xss_cleaned() { $cleaned = array(); foreach ($this->meta()->fields() as $field_id => $field) { if ($field instanceof Jelly_Field_Relationship) { continue; } $cleaned[$field_id] = Html::chars($this->get($field_id)); } return (object) $cleaned; }
<div class="control-group"> <label class="control-label" for="name">Unit Name </label> <div class="controls"> <input placeholder="name" type="text" id="name" value="<?php if (isset($post['name'])) { echo Html::chars($post['name']); } ?> " name="name" required/> </div> </div> <div class="control-group"> <label> </label> <div class="controls"> <input type="hidden" id="id" value="<?php if (isset($_REQUEST['id'])) { echo Html::chars($_REQUEST['id']); } ?> " name="id" /> <input type="submit" value="<?php echo $btName; ?> " name="submit" class="btn" /> </div> </div> </fieldset> </form> </div> </div>
<textarea name="conditionondischarge" id="conditionondischarge" required="required"><?php if (isset($treatmentcycle['conditionondischarge'])) { echo html_entity_decode($treatmentcycle['conditionondischarge']); } ?> </textarea> </div> </div> <!-- nextappointment --> <div class="control-group"> <label class="control-label" for="nextappointment">Appointment for FollowUp</label> <div class="controls"> <input placeholder="Next Appointment Date" type="text" id="date" value="<?php if (isset($post['nextappointment'])) { echo Html::chars($post['nextappointment']); } ?> " name="nextappointment" required data-date-format="yyyy-mm-dd" class="datepicker"/> </div> </div> <div class="control-group"> <label> </label> <div class="controls"> <input type="submit" value="Submit" name="submit" class="btn btn-danger" /> </div> </div> </form> </div> </div>
if ($partial) { ?> <?php $partial->item = is_object($item) ? $item : (object) $item; ?> <?php echo $partial; ?> <?php } else { ?> <?php foreach ($item as $ik => $iv) { ?> <td><?php echo Html::chars($iv); ?> </td> <?php } ?> <?php } ?> </tr> <?php } ?> </tbody> </table> <?php
echo $s['name']; ?> </option> <?php } } ?> </select> </div> </div> <div class="control-group"> <label class="control-label" for="email">Email</label> <div class="controls"> <input placeholder="User Email" type="text" id="name" value="<?php if (isset($post['email'])) { echo Html::chars($post['email']); } ?> " name="email" required/> </div> </div> <?php if (isset($_REQUEST['id'])) { ?> <div class="control-group"> <label> <input type="checkbox" name="update_password" value="1"/> Update Password</label> </div> <?php } ?> <div class="control-group">
/* Copyright (C) Sourcemap 2011 * This program is free software: you can redistribute it and/or modify it under the terms * of the GNU Affero General Public License as published by the Free Software Foundation, * either version 3 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License along with this * program. If not, see <http://www.gnu.org/licenses/>.*/ ?> <td><?php echo $item->id; ?> </td> <td><?php echo Html::chars($item->created); ?> </td> <td><div class="map-thumb" style="width: 10%; float: left;"> <a href="view/<?php echo $item->id; ?> "><img class="medium" src="<?php echo $item->static; ?> " /></a> </div>
public function action_changepass() { $view = View::factory('userchangepass'); $errors = array(); $where = ''; $post = array(); try { //-------------------------------------- //-------CREATE VALIDATION RULE IF ANY-------- $val = Validate::factory($_POST)->filter(TRUE, 'trim')->rule('password', 'not_empty')->rule('oldpass', 'not_empty')->rule('cpass', 'not_empty'); //------------END RULE------------------ //-------------------------------------- //------CREATE AN ARRAY OF POSTED DATA NEEDED----- if (isset($_POST['submit'])) { if ($_POST["password"] == "") { throw new Exception('Password cannot be blank'); } if ($_POST["password"] != $_POST["cpass"]) { throw new Exception('Password do not match'); } $post['password'] = Html::chars($_POST['password']); $post['id'] = ''; $oldpass = Auth::instance()->hash_password($_POST["cpass"]); if (!Auth::instance()->check_password($_POST['oldpass'])) { throw new Exception('The old password you entered is invalid'); } } //-------------END ACCEPTING POSTED DATA---------------------- if (!isset($_POST["submit"])) { $post = $this->model->SelectById($this->user->id); } elseif (isset($_POST['submit'])) { //------------CHECK FOR ANY VALIDATION RULE AND VALIDATE-------- if (!$val->check()) { $errors = $val->errors('event'); throw new Exception(''); } //------------NO PRO! LETS GO THERE-------- $this->model->change_password($post['password'], $this->user->id); Cookie::set('msg', $this->message['sucess_msg']); //------------REGISTRATION SUCESSFUL. WHAT NEXT-------- $this->request->redirect("user/changepass"); } } catch (Exception $e) { //------------ERROR SELE. DISPLAY ERROR-------- $errors[] = $e->getMessage(); } $view->errors = $errors; $view->post = $post; //-------WHICH CAPTION SHOULD WE SHOW FOR OUR BUTTON. MULTILANGUAGE PLEASE-------- $view->btName = $this->message['change']; //------------OUR PRESENTATION PLEASE!-------- $this->template->content = $view; }
public function action_register() { $view = View::factory('new_hmo'); $errors = array(); $where = ''; $post = array(); try { //-------------------------------------- //-------CREATE VALIDATION RULE IF ANY-------- $val = Validate::factory($_POST)->filter(TRUE, 'trim')->rule('firstname', 'not_empty')->filter('middlename', 'trim')->rule('lastname', 'not_empty')->rule('email', 'not_empty')->rule('phoneno', 'trim')->rule('password', 'not_empty')->rule('address', 'not_empty')->rule('name', 'not_empty'); //------------END RULE------------------ //-------------------------------------- //------CREATE AN ARRAY OF POSTED DATA NEEDED----- if (isset($_POST['submit'])) { if ($_POST["password"] != $_POST["copassword"]) { throw new Exception("Password does not match"); } $post['name'] = Html::chars($_POST['name']); $post['address'] = Html::chars($_POST['address']); $post['phoneno'] = Html::chars($_POST['phoneno']); $post['mobile'] = Html::chars($_POST['mobile']); $post['firstname'] = Html::chars($_POST['firstname']); $post['middlename'] = Html::chars($_POST['middlename']); $post['lastname'] = Html::chars($_POST['lastname']); $post['email'] = Html::chars($_POST['email']); $post['status'] = 'disabled'; $post['password'] = Html::chars($_POST['password']); $post['username'] = $post['email']; } if (isset($_POST['submit'])) { //------------CHECK FOR ANY VALIDATION RULE AND VALIDATE-------- if (!$val->check()) { $errors = $val->errors('event'); throw new Exception(''); } //------------NO PRO! LETS GO THERE-------- if ($where == '') { $user = Model::factory('usermd')->save($post, "hmo"); $this->model->save($post, $user->id); } $post['from'] = '*****@*****.**'; $post['to'] = $post['email']; $post['message'] = 'We like to confirm your account. Click here to'; $post['subject'] = 'HMO Account Registration'; Model::factory('messagemd')->SendEmail($post); $this->request->redirect("hmo/register"); } } catch (Exception $e) { //------------ERROR SELE. DISPLAY ERROR-------- $errors[] = $e->getMessage(); } $view->errors = $errors; $view->post = $post; //-------WHICH CAPTION SHOULD WE SHOW FOR OUR BUTTON. MULTILANGUAGE PLEASE-------- if ($where != '') { $view->btName = $this->message['update']; } else { $view->btName = $this->message['submit']; } //------------OUR PRESENTATION PLEASE!-------- $this->template = $view; }
public function action_others() { $view = View::factory("patient_others"); $patientid = $this->request->param("id"); $patient = Model::factory('patientmd')->GetPatient($patientid); if (!is_array($patient)) { $this->request->redirect("patient/search"); } $view->patient = $patient; $treatmentcycle = Model::factory('treatmentcyclemd')->getCurrent($patient['id']); if (!is_array($treatmentcycle)) { $this->request->redirect("treatmentcycle/index/" . $patient['id']); } /* if($treatmentcycle['refertodoctor']!=$this->user->id) $this->request->redirect("index"); */ $treatments = Model::factory('treatmentcyclemd')->GetTreatments($treatmentcycle['id']); $errors = array(); $post = array(); try { $val = Validate::factory($_POST)->filter(TRUE, 'trim'); //------------END RULE------------------ //-------------------------------------- //------CREATE AN ARRAY OF POSTED DATA NEEDED----- if (isset($_POST['submit'])) { $post['nextappointment'] = Html::chars($_POST['nextappointment']); $post['clicnicinformation'] = Html::chars($_POST['clicnicinformation']); $post['complications'] = Html::chars($_POST['complications']); $post['surgicaloperations'] = Html::chars($_POST['surgicaloperations']); $post['indicationforsurgery2'] = Html::chars($_POST['indicationforsurgery2']); $post['conditionondischarge'] = Html::chars($_POST['conditionondischarge']); $post['id'] = $treatmentcycle['id']; } if (isset($_POST['submit'])) { Model::factory('treatmentcyclemd')->update_others($post); Cookie::set('msg', 'yes'); //------------REGISTRATION SUCESSFUL. WHAT NEXT-------- $this->request->redirect("patient/others/" . $patientid); } } catch (Exception $e) { //------------ERROR SELE. DISPLAY ERROR-------- $errors[] = $e->getMessage(); } $view->errors = $errors; $view->post = $post; //-------WHICH CAPTION SHOULD WE SHOW FOR OUR BUTTON. MULTILANGUAGE PLEASE-------- $view->btName = $this->message['submit']; //------------OUR PRESENTATION PLEASE!-------- $view->treatments = $treatments; $view->treatmentcycle = $treatmentcycle; $this->template->content = $view; }
* program. If not, see <http://www.gnu.org/licenses/>.*/ ?> <td><?php echo $item->apikey; ?> </td> <td><?php echo $item->apisecret; ?> </td> <td><?php echo date('r', $item->created); ?> </td> <td><?php echo $item->id; ?> </td> <td><?php echo $item->requests; ?> </td> <td><a href="admin/users/<?php echo $item->user_id; ?> "><?php echo Html::chars($item->owner->username); ?> </a></td>
/** * Compiles an array of HTML attributes into an attribute string. * Attributes will be sorted using Html::$attribute_order for consistency. * * <code> * echo '<div'.Html::attributes($attrs).'>'.$content.'</div>'; * </code> * * @param array $attributes Attribute list * @return string */ public static function attributes(array $attributes = null) { if (empty($attributes)) { return ''; } // Init var $sorted = array(); foreach (Html::$attribute_order as $key) { if (isset($attributes[$key])) { // Add the attribute to the sorted list $sorted[$key] = $attributes[$key]; } } // Combine the sorted attributes $attributes = $sorted + $attributes; $compiled = ''; foreach ($attributes as $key => $value) { if ($value === NULL) { // Skip attributes that have NULL values continue; } if (is_int($key)) { // Assume non-associative keys are mirrored attributes $key = $value; } // Add the attribute value $compiled .= ' ' . $key . '="' . Html::chars($value) . '"'; } return $compiled; }
* See the GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License along with this * program. If not, see <http://www.gnu.org/licenses/>.*/ ?> <td><?php echo $item->id; ?> </td> <td><?php echo Html::chars($item->site); ?> </a></td> <td><?php echo Html::chars($item->alias); ?> </td> <td><a href="admin/supplychains/<?php echo $item->supplychain_id; ?> "><?php echo $item->supplychain_id; ?> </td> <form name="delete-alias" method="post" action="admin/aliases/<?php echo $item->id; ?> /delete_supplychain_alias"> <td><input type ="submit" value="delete" /></form></td>
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License along with this * program. If not, see <http://www.gnu.org/licenses/>.*/ ?> <td><?php echo $item->id; ?> </td> <td><a href="admin/users/<?php echo $item->id; ?> "><?php echo Html::chars($item->username); ?> </a></td> <td><?php echo Html::chars($item->email); ?> </td> <td><img width="32px" height="32px" src="<?php echo Gravatar::avatar($item->email, 32); ?> " /></td> <form name="delete-users" method="post" action="admin/users/<?php echo $item->id; ?> /delete_user"> <td><input type ="submit" value="delete" /></form></td>
<label class="control-label" for="password">Password </label> <div class="controls"> <input type="password" id="name" value="<?php if (isset($post['password'])) { echo Html::chars($post['password']); } ?> " name="password" required/> </div> </div> <div class="control-group"> <label class="control-label" for="password">Confirm Password </label> <div class="controls"> <input type="password" id="name" value="<?php if (isset($post['copassword'])) { echo Html::chars($post['copassword']); } ?> " name="copassword" required/> </div> </div> <div class="control-group"> <label> </label> <div class="controls"> <input type="submit" value="Register" name="submit" class="btn" /> </div> </div> </fieldset> </form> </div>
public function action_costing() { if (!Auth::instance()->logged_in("consultant") and !Auth::instance()->logged_in("technician")) { $this->request->redirect("index"); } $view = View::factory('patientdiagnosis_costing'); $errors = array(); $where = ''; $post = array(); $patientid = $this->request->param("id"); $patient = Model::factory('patientmd')->GetPatient($patientid); if (!is_array($patient)) { $this->request->redirect("index"); } $view->patient = $patient; $treatmentcycle = Model::factory('treatmentcyclemd')->getCurrent($patient['id']); if (!is_array($treatmentcycle)) { $this->request->redirect("treatmentcycle/index/" . $patient['id']); } /* if($treatmentcycle['refertodoctor']!=$this->user->id) $this->request->redirect("index"); */ $treatments = Model::factory('treatmentcyclemd')->GetTreatments($treatmentcycle['id']); try { if (isset($_POST['submit']) and count($treatments) > 0) { foreach ($treatments as $t) { $id = $t['id']; if (!isset($_POST["cost{$id}"])) { continue; } $post['treatment'] = $id; $post['date'] = date("Y/m/j"); $post['userid'] = $this->user->id; $post['cost'] = Html::chars($_POST['cost' . $id]); $this->model->save_costing($post); } Cookie::set('msg', 'yes'); $this->request->redirect("patientdiagnosis/costing/" . $patientid); } } catch (Exception $e) { //------------ERROR SELE. DISPLAY ERROR-------- $errors[] = $e->getMessage(); } $view->errors = $errors; $view->post = $post; //-------WHICH CAPTION SHOULD WE SHOW FOR OUR BUTTON. MULTILANGUAGE PLEASE-------- if ($where != '') { $view->btName = $this->message['update']; } else { $view->btName = $this->message['submit']; } //------------OUR PRESENTATION PLEASE!-------- $view->treatmentcycle = $treatmentcycle; $view->treatments = $treatments; $this->template->content = $view; }
echo $form->open(); ?> <?php echo $form->errors(); ?> <p> <?php echo $form->name->label(); ?> <span><a href="<?php echo Route::url('category', array('link' => $form->link)); ?> "><?php echo Html::chars($form->name); ?> </a></span> </p> <p> <?php echo $form->title->label(); ?> <span><?php echo $form->title; ?> </span> </p> <p>
/* Copyright (C) Sourcemap 2011 * This program is free software: you can redistribute it and/or modify it under the terms * of the GNU Affero General Public License as published by the Free Software Foundation, * either version 3 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License along with this * program. If not, see <http://www.gnu.org/licenses/>.*/ ?> <td><?php echo $item->id; ?> </td> <td><?php echo Html::chars($item->name); ?> </td> <td><?php echo Html::chars($item->description); ?> </td> <form name="delete-role-entry" method="post" action="admin/roles/<?php echo $item->id; ?> /delete_role_entry"> <td><input type ="submit" value="delete" /></form></td>
">Zarządzaj obrazkami</a></li> <?php } ?> <li><a href="<?php echo Route::url('protected', array('controller' => 'image', 'action' => 'create', 'id' => $project->link)); ?> ">Dodaj obrazek</a></li> </ul> </div> </header> <div> <span>Opis:</span> <span><?php echo Text::limit_words(Html::chars(strip_tags($project->description)), 15); ?> </span> </div> </article> <?php } ?> <?php } else { ?> <article> <p>Brak projektów w tej kategorii</p> </article> <?php }
* program. If not, see <http://www.gnu.org/licenses/>.*/ ?> <td><a href="admin/supplychains/<?php echo $item->id; ?> "><?php echo $item->id; ?> </a></td> <td><?php echo Html::chars($item->created); ?> </td> <td><?php echo Html::chars($item->owner); ?> </td> <td><img class="medium" src="static/<?php echo $item->id; ?> .m.png" /></td> <td> <?php if (isset($item->attributes['title'])) { ?> <?php echo HTML::chars($item->attributes['title']); ?> <?php }
if (isset($post['middlename'])) { echo Html::chars($post['middlename']); } ?> " name="middlename" /> <div class="break"></div> <label for="lastname">Last Name: </label> <input type="text" id="lastname" value="<?php if (isset($post['lastname'])) { echo Html::chars($post['lastname']); } ?> " name="lastname" /> <div class="break"></div> <label for="phoneno">Phone No: </label> <input type="text" id="phoneno" value="<?php if (isset($post['phoneno'])) { echo Html::chars($post['phoneno']); } ?> " name="phoneno" /> <div class="break"></div> <label> </label> <input type="submit" value="<?php echo $btName; ?> " name="submit" /> </form>
if (isset($post['presumptivediagnosis'])) { echo Html::chars($post['presumptivediagnosis']); } ?> </textarea></td> </tr> <tr> <td>Plan/Action taken</td> <td><textarea name="actiontaken" cols="70" id="actiontaken" <?php if (isset($disable_as)) { echo 'disabled="disabled"'; } ?> ><?php if (isset($post['actiontaken'])) { echo Html::chars($post['actiontaken']); } ?> </textarea></td> </tr> <?php if (Auth::instance()->logged_in("consultant")) { ?> <tr> <td> </td> <td><input type="submit" value="Submit" name="as" class="btn btn-danger" /> </td> </tr> <?php } ?> </table>
public function action_comment() { $feed_id = $this->request->post('id'); $data = $this->request->post('data'); $comment = ORM::factory('feedcomment'); $comment->comment = $data; $comment->feed_id = $feed_id; $comment->date = strtotime(date('d-m-Y G:i:s')); $comment->user_id = Auth::instance()->get_user()->id; $comment->save(); $image = CacheImage::instance(); $curr_user = Auth::instance()->get_user(); $curr_avatar = $image->resize($curr_user->avatar, 40, 40); $span = Date::fuzzy_span($comment->date); $json = array('name' => $curr_user->firstname . " " . $curr_user->lastname, 'img' => $curr_avatar, 'text' => Html::chars($comment->comment), 'time' => $span, 'comment_id' => $comment->id); echo json_encode($json); exit; }
?> "><img src='<?php echo $comment_img; ?> ' style='width: 40px; height: 40px;' /></a> </td> <td class='vatop pad5' style='width: 350px;'> <a href="<?php echo $url . "/" . $comment->user_id; ?> " style='font-size: 14px; font-weight: bold;'><?php echo $comment_user->firstname . " " . $comment_user->lastname; ?> </a> <span class='hpad10' style='font-size: 12px;'><?php echo Html::chars($comment->comment); ?> </span> <p class='vpad10' style='font-size: 11px; color: #777;'><?php echo Date::fuzzy_span($comment->date); ?> </p> </td> <td class="vatop w2 pad5"> <?php if (Acl::instance()->is_allowed('post_delete') && $role == 'Admin') { ?> <a onclick="delete_comment(this, <?php echo $comment->id; ?> );" class="del-comment" style="font-size: 11px; font-weight: bold; display: none; cursor: pointer;">X</a>
<div class="option-create"> <a href="<?php echo Route::url('protected', array('controller' => 'category', 'action' => 'create')); ?> ">Utwórz nową kategorię</a> </div> <?php foreach ($categories->execute() as $category) { ?> <article> <header> <div> <span>Nazwa:</span> <span><?php echo Html::chars($category->name); ?> </span> </div> <div> <span>Tytuł:</span> <span><?php echo Text::limit_chars($category->title, 20); ?> </span> </div> <div> <span>Projektów:</span> <?php if (($count = $category->projects->count()) > 0) { ?>
public function action_index() { $view = View::factory('technicianm'); $errors = array(); $where = ''; $post = array(); try { //-------------------------------------- //-------CREATE VALIDATION RULE IF ANY-------- $val = Validate::factory($_POST)->filter(TRUE, 'trim'); //------------END RULE------------------ //-------------------------------------- //------CREATE AN ARRAY OF POSTED DATA NEEDED----- if (isset($_POST['submit'])) { $post['firstname'] = Html::chars($_POST['firstname']); $post['middlename'] = Html::chars($_POST['middlename']); $post['lastname'] = Html::chars($_POST['lastname']); $post['unit'] = Html::chars($_POST['unit']); $post['names'] = $post['firstname'] . " " . $post['middlename'] . " " . $post['lastname']; if (!isset($_REQUEST['id'])) { if ($_POST["password"] != $_POST["copassword"]) { throw new Exception("Password does not match"); } $post['email'] = Html::chars($_POST['email']); $post['username'] = $post['email']; $post['password'] = Html::chars($_POST['password']); } } //-------------END ACCEPTING POSTED DATA---------------------- if (isset($_REQUEST['id'])) { $where = Html::chars($_REQUEST['id']); } if (!isset($_POST["submit"])) { if ($where != '') { $post = $this->model->SelectById($where); if (!is_array($post)) { throw new Exception('Invalid data'); } } } elseif (isset($_POST['submit'])) { if ($where == '') { $user = Model::factory('usermd')->save($post, "technician"); $this->model->save($post, $user->id); } else { $post['id'] = $where; $owner = $this->model->SelectById($post['id']); $post['userid'] = $owner['userid']; $this->model->update($post); if (isset($_POST["update_password"])) { Model::factory('usermd')->change_password($_POST["password"], $owner['userid']); } } Cookie::set('msg', 'yes'); //------------REGISTRATION SUCESSFUL. WHAT NEXT-------- $this->request->redirect("technician/index"); } } catch (Exception $e) { //------------ERROR SELE. DISPLAY ERROR-------- $errors[] = $e->getMessage(); } $view->errors = $errors; $view->post = $post; //-------WHICH CAPTION SHOULD WE SHOW FOR OUR BUTTON. MULTILANGUAGE PLEASE-------- if ($where != '') { $view->btName = $this->message['update']; } else { $view->btName = $this->message['submit']; } //------------OUR PRESENTATION PLEASE!-------- $view->units = Model::factory('providermd')->SelectAll(); $this->template->content = $view; }
public function action_treatment() { if (!Auth::instance()->logged_in("consultant") and !Auth::instance()->logged_in("technician")) { $this->request->redirect("index"); } $view = View::factory('treatmentm'); $patient = Model::factory('patientmd')->GetPatient($this->request->param("id")); if (!is_array($patient)) { $this->request->redirect("index"); } $errors = array(); $where = ''; $post = array(); $treatmentcycle = $this->model->getCurrent($patient['id']); if (!is_array($treatmentcycle)) { $this->request->redirect("treatmentcycle/index/" . $patient['id']); } try { //-------------------------------------- //-------CREATE VALIDATION RULE IF ANY-------- $val = Validate::factory($_POST)->filter(TRUE, 'trim')->rule('treatment', 'not_empty')->rule('provider', 'not_empty')->filter('date', 'trim'); //------------END RULE------------------ //-------------------------------------- //------CREATE AN ARRAY OF POSTED DATA NEEDED----- if (isset($_POST['submit'])) { $post['treatment'] = Html::chars($_POST['treatment']); $post['provider'] = Html::chars($_POST['provider']); $post['consultant'] = Html::chars($_POST['consultant']); $post['date'] = Html::chars($_POST['date']); $post['userid'] = $this->user->id; $post['patientid'] = $patient['id']; $post['treatmentcycle'] = $treatmentcycle['id']; } //-------------END ACCEPTING POSTED DATA---------------------- if (isset($_REQUEST['id'])) { $where = Html::chars($_REQUEST['id']); } if (!isset($_POST["submit"])) { if ($where != '') { $post = Model::factory('treatmentcyclemd')->GetTreatment($where); if (!is_array($post)) { throw new Exception('Invalid data'); } } } elseif (isset($_POST['submit'])) { //------------CHECK FOR ANY VALIDATION RULE AND VALIDATE-------- if (!$val->check()) { $errors = $val->errors('event'); throw new Exception(''); } //------------NO PRO! LETS GO THERE-------- if ($where == '') { $this->model->save_treatment($post); } else { $post['id'] = $where; $this->model->update_treatment($post); } Cookie::set('msg', 'yes'); //------------REGISTRATION SUCESSFUL. WHAT NEXT-------- $this->request->redirect("treatmentcycle/treatment/" . $patient['id']); } } catch (Exception $e) { //------------ERROR SELE. DISPLAY ERROR-------- $errors[] = $e->getMessage(); } $view->errors = $errors; $view->post = $post; //-------WHICH CAPTION SHOULD WE SHOW FOR OUR BUTTON. MULTILANGUAGE PLEASE-------- if ($where != '') { $view->btName = $this->message['update']; } else { $view->btName = $this->message['submit']; } //------------OUR PRESENTATION PLEASE!-------- $view->shp = Model::factory('providermd')->SelectAll(); $view->technicians = Model::factory('technicianmd')->SelectAll(); $view->list = Model::factory('treatmentcyclemd')->GetTreatments($treatmentcycle['id']); $view->patient = $patient; $this->template->content = $view; }
/** * Gets a string representation of the value, formatted according to the * fields type. * * @param Jelly_Model $model * @param mixed $value * @return String **/ public function display($model, $value) { return Html::chars($value . ''); }
<?php echo Html::chars('<p>"I\'m hungry"—Cookie Monster said.</p>'); ?> <br/> <?php echo Html::chars('<p>"I\'m hungry"—Cookie Monster said.</p>', FALSE); ?> <br/> <?php echo Html::anchor('controller/action', 'My Link'); ?> <br/> <?php echo Html::anchor('http://kohanaphp.com', 'Kohana PHP'); ?> <br/> <?php echo Html::anchor('controller/action', 'My Link', array('id' => 'link_id'), 'ftp'); ?> <br/>