Inheritance: extends AppModel
 public function run()
 {
     $specialty = new Specialty();
     $specialty->specialty_name = 'Sellers';
     $specialty->save();
     $specialty2 = new Specialty();
     $specialty2->specialty_name = 'Probate Sellers';
     $specialty2->save();
     $specialty3 = new Specialty();
     $specialty3->specialty_name = 'Senior Sellers';
     $specialty3->save();
 }
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy($id)
 {
     $specialty = Specialty::find($id);
     if (!is_null($specialty)) {
         if ($specialty->delete()) {
             return Redirect::route('admin.specialties.index')->withErrors(array('mainSuccess' => 'Специалността е успешно изтрита.'));
         } else {
             return Redirect::route('admin.specialties.index')->withErrors(array('mainError' => 'Грешка с базата данни.'));
         }
     } else {
         return Redirect::route('admin.specialties.index')->withErrors(array('mainError' => 'Специалността не е намерена.'));
     }
 }
 public function update($id)
 {
     $data = array("first_name" => Input::get("first_name"), "last_name" => Input::get("last_name"), "email" => Input::get("email"), "phone" => Input::get("phone"), "picture" => Input::file("picture"), "specialty_id" => Input::get("specialty_id"), "dating_duration" => Input::get("dating_duration"));
     $rules = array("first_name" => 'required|min:1|max:255', "last_name" => 'required|min:1|max:100', "email" => 'required|min:1', "phone" => 'required|min:1|max:100', "specialty_id" => 'required|min:3|max:255', "dating_duration" => 'required|min:1|max:3', "picture" => 'mimes:jpeg,gif,png');
     $messages = array('required' => 'El campo :attribute es obligatorio.', 'min' => 'El campo :attribute no puede tener menos de :min carácteres.', 'email' => 'El campo :attribute debe ser un email válido.', 'max' => 'El campo :attribute no puede tener más de :max carácteres.', 'numeric' => 'El campo :attribute debe contener solo numeros', 'mimes' => 'El formato de la imagen logo debe ser jpg, git, png');
     $validation = Validator::make(Input::all(), $rules, $messages);
     //si la validación falla redirigimos al formulario de registro con los errores
     //y con los campos que nos habia llenado el usuario
     if ($validation->fails()) {
         return Redirect::to('/doctor/profile')->withErrors($validation)->withInput();
     } else {
         $doctor = Doctor::find($id);
         $agenda = Agenda::where('doctor_id', $doctor->id)->first();
         $agenda->dating_duration = Input::get("dating_duration");
         $agenda->save();
         $espes = explode(',', Input::get("specialty_id"));
         $espeuok = '';
         foreach ($espes as $espe) {
             $very = Specialty::where('name_es', $espe)->first();
             if ($very) {
                 $espeuok = $espeuok . ',' . $very->id;
             }
         }
         $doctor->specialty_id = $espeuok;
         $doctor->save();
         $user = User::find($doctor->user_id);
         $user->first_name = $data['first_name'];
         $user->last_name = $data['last_name'];
         $user->save();
         $profile = Profile::where('user_id', $doctor->user_id)->first();
         if (Input::file('picture') != NULL) {
             //agrega imagen de logo
             $file_logo = Input::file('picture');
             $ext = Input::file('picture')->getClientOriginalExtension();
             $nameIMG = date('YmdHis');
             $logo = $nameIMG . '.' . $ext;
             $logo = 'assets/doctor/images/profile_pic/profile_' . $logo;
             $profile->picture = $logo;
         }
         $profile->phone = Input::get("phone");
         $profile->save();
         if ($profile) {
             if (Input::file('picture') != NULL) {
                 $file_logo->move("assets/doctor/images/profile_pic/", $logo);
             }
             return Redirect::to('/doctor/profile')->withFlash_message("Guardado Exitosamente");
         } else {
             return Redirect::to('/doctor/profile')->withErrors("Error")->withInput();
         }
     }
 }
Exemple #4
0
 /**
  * Get the Specialty for this event type (as defined by the first camelcase section of the module name)
  *
  * @return Specialty
  */
 public function getSpecialty()
 {
     preg_match('/^([A-Z][a-z]+)([A-Z][a-z]+)([A-Z][a-z]+)$/', $this->class_name, $m);
     return Specialty::model()->find('code=?', array(strtoupper($m[1])));
 }
Exemple #5
0
echo $form->labelEx($model, 'title');
?>
        <?php 
echo $form->textField($model, 'title', array('size' => 60, 'maxlength' => 255));
?>
        <?php 
echo $form->error($model, 'title');
?>
    </div>

    <div class="row">
        <?php 
echo $form->labelEx($model, 'id_speciality');
?>
        <?php 
echo $form->dropDownList($model, 'id_speciality', Specialty::getAll(), array('empty' => 'Выберите пункт'));
?>
        <?php 
echo $form->error($model, 'id_speciality');
?>
    </div>
    
    <div id="parent">        
    </div>

    <div class="row buttons">
        <?php 
echo CHtml::submitButton($model->isNewRecord ? 'Сохранить' : 'Изменить');
?>
        <?php 
echo CHtml::button('Отмена', array('onclick' => "window.location='/discipline/addcurriculum'"));
Exemple #6
0
echo Yii::t('translation', 'layout.site.It_s_FREE');
?>
</strong></p>
                <?php 
echo CHtml::form(Yii::app()->createAbsoluteUrl('/search/index/'), 'get', array('id' => 'search-form', 'class' => 'jNice'));
?>
                	<input type="hidden" name="find-doctor" value="1" />
                    <fieldset>
                        <p class="type"><?php 
echo Yii::t('translation', 'layout.site.Find_a_Doctor');
?>
</p>
                        <div class="group">
                            <div class="row">
                                <?php 
echo CHtml::dropDownList('specialty', '', Specialty::findAllArray());
?>
                            </div>
                            <div class="row">
                                <?php 
echo CHtml::dropDownList('hospital', '', Hospital::findAllArray());
?>
                            </div>
                        </div>
                        <div class="group">
                            <div class="row">
                                <?php 
echo CHtml::dropDownList('insurance', '', Insurance::findAllArray());
?>
                            </div>
                            <div class="row">
 public static function getList()
 {
     $list = array();
     if (!empty(Yii::app()->params['contact_labels'])) {
         foreach (Yii::app()->params['contact_labels'] as $label) {
             if (preg_match('/{SPECIALTY}/', $label)) {
                 if (!($specialty = Specialty::model()->find('code=?', array(Yii::app()->params['institution_specialty'])))) {
                     throw new Exception("Institution specialty not configured");
                 }
                 $list['nonspecialty'] = preg_replace('/{SPECIALTY}/', $specialty->adjective, $label);
             } else {
                 $list[$label] = $label;
             }
         }
     }
     return $list;
 }
Exemple #8
0
<?php

$this->pageTitle = 'Список групп';
?>
<h1><?php 
echo $this->pageTitle;
?>
</h1>

<?php 
echo CHtml::link('Добавть новую группу', array("user/changegroup"));
$this->widget('zii.widgets.grid.CGridView', array('id' => 'user-grid', 'dataProvider' => $groups->search(), 'filter' => $groups, 'emptyText' => 'В базе нет групп', 'columns' => array('title', array('name' => 'id_speciality', 'value' => '$data->idSpecialty->title', 'filter' => Specialty::getAll()), 'year_income', array('class' => 'CButtonColumn', 'template' => '{update}{delete}', 'updateButtonUrl' => 'Yii::app()->createUrl("user/changegroup", array("id"=>$data->id_group))', 'deleteButtonUrl' => 'Yii::app()->createUrl("user/deletegroup", array("id"=>$data->id_group))'))));
		            	<div class="modal-header">
		            			<button type="button" class="close" data-dismiss="modal" aria-hidden="true"><i class="fa fa-times"></i></button>
		            			<h4 class="modal-title"><i class="fa fa-filter"></i> Filtra por</h4>
		            	</div>
		            	<!-- //modal-header-->
		            	<div class="modal-body" style="padding-bottom:0">
		            		{{Form::open(array('method'=>'GET','class' => 'cmxform form-horizontal adminex-form', 'action' => 'PatientsController@index', 'files' => 'true'))}}
		            			
                                <label class="control-label">Motivo Consulta </label>
                                <div class="form-group">
		            				{{ Form::text('motivo', NULL,['id'=>'motivo', 'class' => 'form-control'])}}
		            			</div>
                                <label class="control-label">Especialidad Medica</label>
                                <div class="form-group ">
                                         <?php 
$spec = Specialty::all();
?>
                                     <select class="selectpicker form-control" data-size="10" data-live-search="true"  name="specialty">
                                        <option  value="" selected>Seleccione una Especialidad</option>
                                        @foreach($spec as $spe)
                                         <option  value="{{$spe->id}}">{{$spe->name_es}}</option>
                                        @endforeach 
                                    </select>     
                                </div>

                                <label class="control-label">Fecha Consulta </label><br>
                                <label class="control-label">Desde </label>
		            	        <div class='form-group input-group date datetimepicker2'>
                                    <input parsley-required="true" name="star" type='text' placeholder="Día-Mes-Año" class="form-control" />
                                    <span class="input-group-addon">
                                        <i class="fa fa-calendar"></i>
 public function actionListSpecialty()
 {
     $model = new Specialty('search');
     $model->unsetAttributes();
     // clear any default values
     if (isset($_GET['Specialty'])) {
         $model->attributes = $_GET['Specialty'];
     }
     $this->render('listSpecialty', array('model' => $model));
 }
Exemple #11
0
}
?>
	
	<?php 
if ($student) {
    ?>
	<div id="showFormStudent">
		<?php 
    echo $form->errorSummary($student);
    ?>
	    <div class="row">
	    <?php 
    echo $form->labelEx($student, 'id_specialty');
    ?>
	    <?php 
    echo $form->dropDownList($student, 'id_specialty', Specialty::getAll(), array('empty' => 'Выберите специальность'));
    ?>
	    <?php 
    echo $form->error($student, 'id_specialty');
    ?>
	    </div>

	    <div class="row">
	        <?php 
    echo $form->labelEx($student, 'year_income');
    ?>
	        <?php 
    echo $form->textField($student, 'year_income', array('size' => 4, 'maxlength' => 4));
    ?>
	        <?php 
    echo $form->error($student, 'year_income');
Exemple #12
0
 public function specialties()
 {
     $specialties = Specialty::All()->toArray();
     return Response::json(array("specialties" => $specialties));
 }
 /**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function edit($id)
 {
     $school = School::find($id);
     if (is_null($school)) {
         return Redirect::route('admin.schools.index')->withErrors(array('mainError' => 'Учебното заведение не е намерено.'));
     } else {
         if ($school->canUserEdit() == false) {
             return Redirect::route('admin.schools.index')->withErrors(array('mainError' => 'Нямате право да редактирате учебното заведение.'));
         }
         $types_data = Type::lists("name", "id");
         $financings_data = Financing::lists("name", "id");
         $specialties_data = Specialty::lists("name", "id");
         return View::make('admin.school.edit')->with('school', $school)->with('types_data', $types_data)->with('specialties_data', $specialties_data)->with('financings_data', $financings_data);
     }
 }
Exemple #14
0
 /**
  * @covers Specialty::model
  *
  * @todo   Implement testModel().
  */
 public function testModel()
 {
     $this->assertEquals('Specialty', get_class(Specialty::model()), 'Class name should match model.');
 }
Exemple #15
0
 public static function listFilters()
 {
     $filters_data['all'] = array(array('name' => 'Вид', 'list' => Type::select('id', 'name')->get()->toArray()), array('name' => 'Финансиране', 'list' => Financing::select('id', 'name')->get()->toArray()), array('name' => 'Специалности', 'list' => Specialty::select('id', 'name')->get()->toArray()));
     if (Input::has('district') == false && Input::has('municipality') == false && Input::has('city') == false) {
         $filters_data['all'][] = array('name' => 'Област', 'list' => District::select('id', 'name')->get()->toArray());
     }
     if (Input::has('district') == true && Input::has('municipality') == false && Input::has('city') == false) {
         $district = Input::get('district');
         if (is_array(Input::get('district'))) {
             $district = end($district);
         }
         $filters_data['all'][] = array('name' => 'Община', 'previous' => 'Област', 'list' => Municipality::select('id', 'name')->where('district_id', '=', $district)->get()->toArray());
         $filters_data['previous_location'] = URL::route('schools.index', Input::except('district', 'municipality', 'city'));
     }
     if (Input::has('district') == true && Input::has('municipality') == true || Input::has('municipality') == true || Input::has('city') == true) {
         $municipality = Input::get('municipality');
         if (is_array(Input::get('municipality'))) {
             $municipality = end($municipality);
         }
         $filters_data['all'][] = array('name' => 'Град/село', 'previous' => 'Община', 'list' => City::select('id', 'name')->where('municipality_id', '=', $municipality)->get()->toArray());
         $filters_data['previous_location'] = URL::route('schools.index', Input::except('municipality', 'city'));
     }
     $input_filter = array_filter(Input::only('city', 'district', 'financing', 'municipality', 'specialty', 'type'));
     if (!empty($input_filter)) {
         $filters_data['clean_all_filters'] = URL::route('schools.index', array_filter(Input::only('search')));
     }
     return $filters_data;
 }
 public function edit($id)
 {
     if (Payment::VeryPayment() == false) {
         return View::make('clinic.payment.renews-payment');
     }
     $user = Sentry::getUser();
     $clinic = Clinic::where('user_id', $user->id)->first();
     $doctor = Doctor::where('clinic_id', $clinic->id)->where('id', $id)->first();
     $agenda = Agenda::where('doctor_id', $doctor->id)->first();
     $esps = explode(',', $doctor->specialty_id);
     $espok = '';
     $array = array();
     foreach ($esps as $esp) {
         $very = Specialty::where('id', $esp)->first();
         if ($very) {
             $array[] = array('value' => $very->id, 'text' => $very->name_es);
         }
     }
     $profile = Profile::where('user_id', $doctor->user_id)->first();
     return View::make('clinic.doctors.edit', ['agenda' => $agenda, 'doctor' => $doctor, 'profile' => $profile, 'specialty' => $array]);
 }
                                            {{ Form::text('clinic_name', NULL, ['class' => 'form-control', 'placeholder'=>'Ej. Clinica']) }}
                                        </div>
                                    </div>

                                    <div class="form-group col-ms-12">
                                        <label for="firstname" class="control-label col-md-2">Correo Electronico</label>
                                        <div class="col-md-10">
                                            {{ Form::text('email', NULL, ['class' => 'form-control', 'placeholder'=>'Ej. nombre15@ejemplo.com']) }}
                                        </div>
                                    </div>

                                    <div class="form-group ">
                                        <label for="password" class="control-label col-lg-2">Especialidad</label>
                                        <div class="col-lg-10">
                                             <?php 
$spe = Specialty::lists('name_es', 'id');
?>
                                            {{ Form::text('specialty_id', NULL, ['class' => 'form-control', 'placeholder'=>'Ej. 1,2,3,4,5']) }}
                                        </div>
                                    </div>

                                    <div class="form-group col-ms-12">
                                        <label for="firstname" class="control-label col-md-2">Telefono Celular</label>
                                        <div class="col-md-10">
                                            {{ Form::text('phone', NULL, ['class' => 'form-control', 'placeholder'=>'8888888888']) }}
                                        </div>
                                    </div>

                                    <div class="form-group col-ms-12">
                                        <label for="firstname" class="control-label col-md-2">lenguaje</label>
                                        <div class="col-md-10">
Exemple #18
0
 public function removeDiagnosis($diagnosis_id)
 {
     if (!($sd = SecondaryDiagnosis::model()->findByPk($diagnosis_id))) {
         throw new Exception('Unable to find secondary_diagnosis: ' . $diagnosis_id);
     }
     if (!($disorder = Disorder::model()->findByPk($sd->disorder_id))) {
         throw new Exception('Unable to find disorder: ' . $sd->disorder_id);
     }
     if ($disorder->specialty_id) {
         $type = strtolower(Specialty::model()->findByPk($disorder->specialty_id)->code);
     } else {
         $type = 'sys';
     }
     if (!$sd->delete()) {
         throw new Exception('Unable to delete diagnosis: ' . print_r($sd->getErrors(), true));
     }
     $this->audit('patient', "remove-{$type}-diagnosis");
 }
		<h3>Describe your event type:</h3>
		<label>Specialty:</label>
		<?php 
echo CHtml::dropDownList('Specialty[id]', empty($_REQUEST) ? Specialty::model()->find('code=?', array(130))->id : @$_REQUEST['Specialty']['id'], CHtml::listData(Specialty::model()->findAll(array('order' => 'name')), 'id', 'name'));
?>
<br />
		<label>Event group:</label>
		<?php 
echo CHtml::dropDownList('EventGroup[id]', empty($_REQUEST) ? EventGroup::model()->find('code=?', array('Mi'))->id : @$_REQUEST['EventGroup']['id'], CHtml::listData(EventGroup::model()->findAll(array('order' => 'name')), 'id', 'name'));
?>
<br />
		<label>Name of event type:</label>
		<input type="text" name="EventTypeModuleCode[moduleSuffix]" value="<?php 
echo @$_POST['EventTypeModuleCode']['moduleSuffix'];
?>
" size="65" id="moduleSuffix" /><br/>
		<?php 
if (isset($this->form_errors['EventTypeModuleCode[moduleSuffix]'])) {
    ?>
			<span style="color: #f00; margin-bottom: 10px; display: inline-block;"><?php 
    echo $this->form_errors['EventTypeModuleCode[moduleSuffix]'];
    ?>
</span>
		<?php 
}
?>

		<label>Event type short name:</label>
		<input type="text" name="EventTypeModuleCode[moduleShortSuffix]" value="<?php 
echo @$_POST['EventTypeModuleCode']['moduleShortSuffix'];
?>
 public function actionPossiblecontacts()
 {
     $term = strtolower(trim($_GET['term'])) . '%';
     switch (strtolower(@$_GET['filter'])) {
         case 'staff':
             $contacts = User::model()->findAsContacts($term);
             break;
         case 'nonspecialty':
             if (!($specialty = Specialty::model()->find('code=?', array(Yii::app()->params['institution_specialty'])))) {
                 throw new Exception("Unable to find specialty: " . Yii::app()->params['institution_specialty']);
             }
             $contacts = Contact::model()->findByLabel($term, $specialty->default_title, true, 'person');
             break;
         default:
             $contacts = Contact::model()->findByLabel($term, @$_GET['filter'], false, 'person');
     }
     echo CJavaScript::jsonEncode($contacts);
 }
Exemple #21
0
 public function findAllByCurrentSpecialty()
 {
     if (!isset(Yii::app()->params['institution_specialty'])) {
         throw new Exception('institution_specialty code is not set in params');
     }
     if (!($specialty = Specialty::model()->find('code=?', array(Yii::app()->params['institution_specialty'])))) {
         throw new Exception('Specialty not found: ' . Yii::app()->params['institution_specialty']);
     }
     $criteria = new CDbCriteria();
     $criteria->addCondition('specialty_id = :specialty_id');
     $criteria->params[':specialty_id'] = $specialty->id;
     $criteria->order = 'name asc';
     return self::model()->findAll($criteria);
 }
Exemple #22
0
 /**
  * Get the Specialty of the Firm
  *
  * @return Specialty|null
  */
 public function getSpecialty()
 {
     $result = Yii::app()->db->createCommand()->select('su.specialty_id as id')->from('subspecialty su')->join('service_subspecialty_assignment svc_ass', 'svc_ass.subspecialty_id = su.id')->join('firm f', 'f.service_subspecialty_assignment_id = svc_ass.id')->where('f.id = :fid', array(':fid' => $this->id))->queryRow();
     if (empty($result)) {
         return null;
     } else {
         return Specialty::model()->findByPk($result['id']);
     }
 }
<h1><?php 
echo $this->pageTitle;
?>
</h1>
<?php 
echo CHtml::dropDownList('specialty', '', Specialty::getAll(), array('empty' => 'Выберите пункт'));
?>
<div id="newRecord">
</div>
<?//php $this->renderPartial('_form', array('model'=>$discipline)); ?>
<?php 
Yii::app()->clientScript->registerCoreScript('jquery');
?>
<script>
    $('#specialty').change(function() {
        $.ajax({
            type: 'POST',
            url: location,
            data:{  id_speciality: $(this).val()},
            success: function(data){
                $('#newRecord').html(data);
            }
        });
    });
</script>
    public static function eventTypeProperties($event_type_id)
    {
        $event_type = EventType::model()->findByPk($event_type_id);
        $event_type_short_name = EventTypeModuleCode::getEventShortName($event_type);
        if (empty($_POST)) {
            if (!preg_match('/^([A-Z][a-z]+)([A-Z][a-z]+)([A-Z][a-zA-Z]+)$/', $event_type->class_name, $m)) {
                die("ERROR: {$event_type->class_name}");
            }
            $specialty_id = Specialty::model()->find('abbreviation=?', array(strtoupper($m[1])))->id;
            $event_group_id = EventGroup::model()->find('code=?', array($m[2]))->id;
            $event_type_name = $event_type->name;
        } else {
            $specialty_id = @$_REQUEST['Specialty']['id'];
            $event_group_id = @$_REQUEST['EventGroup']['id'];
            $event_type_name = @$_REQUEST['EventTypeModuleCode']['moduleSuffix'];
        }
        ?>
		<label>Specialty: </label>
		<?php 
        echo CHtml::dropDownList('Specialty[id]', $specialty_id, CHtml::listData(Specialty::model()->findAll(array('order' => 'name')), 'id', 'name'));
        ?>
<br/>
		<label>Event group: </label><?php 
        echo CHtml::dropDownList('EventGroup[id]', $event_group_id, CHtml::listData(EventGroup::model()->findAll(array('order' => 'name')), 'id', 'name'));
        ?>
<br />
		<label>Name of event type: </label> <?php 
        echo CHtml::textField('EventTypeModuleCode[moduleSuffix]', $event_type_name, array('size' => 65, 'id' => 'moduleSuffix'));
        ?>
<br />
		<label>Event type short name: </label> <?php 
        echo CHtml::textField('EventTypeModuleCode[moduleShortSuffix]', $event_type_short_name, array('size' => 65, 'id' => 'moduleShortSuffix'));
        ?>
<br />
		<?php 
    }
Exemple #25
0
echo $form->labelEx($model, 'title');
?>
        <?php 
echo $form->textField($model, 'title', array('size' => 20, 'maxlength' => 20));
?>
        <?php 
echo $form->error($model, 'title');
?>
    </div>

    <div class="row">
        <?php 
echo $form->labelEx($model, 'id_speciality');
?>
        <?php 
echo $form->dropDownList($model, 'id_speciality', Specialty::getAll(), array('empty' => 'Выбирети специальность'));
?>
        <?php 
echo $form->error($model, 'id_speciality');
?>
    </div>

    <div class="row">
        <?php 
echo $form->labelEx($model, 'year_income');
?>
        <?php 
echo $form->textField($model, 'year_income', array('size' => 4, 'maxlength' => 4));
?>
        <?php 
echo $form->error($model, 'year_income');