/**
  * 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 FirstAid the loaded model
  * @throws CHttpException
  */
 public function loadModel($id)
 {
     $model = FirstAid::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }
 public function actionTranslate()
 {
     $sqlsm = "";
     $sqlm = "";
     $i = 0;
     $authorities = Authority::model()->findAll();
     foreach ($authorities as $r) {
         $sqlsm .= "insert into `SourceMessage` values (" . $i . ",'authorities','authority_" . htmlentities($r->id, ENT_QUOTES, 'UTF-8') . "_charge');<br>";
         $sqlm .= "insert into `Message` values (" . $i . ",'es','" . htmlentities($r->charge, ENT_QUOTES, 'UTF-8') . "');<br>";
         $sqlm .= "insert into `Message` values (" . $i++ . ",'en','');<br>";
     }
     echo $sqlsm;
     echo $sqlm;
     echo "<br/>";
     $numbers = Numbers::model()->findAll();
     $sqlsm = "";
     $sqlm = "";
     $i = 34;
     foreach ($numbers as $s) {
         $sqlsm .= "insert into `SourceMessage` values (" . $i . ",'numbers','numbers_" . htmlentities($s->id, ENT_QUOTES, 'UTF-8') . "_field');<br>";
         $sqlm .= "insert into `Message` values (" . $i . ",'es','" . htmlentities($s->field, ENT_QUOTES, 'UTF-8') . "');<br>";
         $sqlm .= "insert into `Message` values (" . $i++ . ",'en','');<br>";
     }
     echo $sqlsm;
     echo $sqlm;
     echo "<br/>";
     $services = Service::model()->findAll();
     $sqlsm = "";
     $sqlm = "";
     $i = 68;
     foreach ($services as $s) {
         $sqlsm .= "insert into `SourceMessage` values (" . $i . ",'services','services_" . htmlentities($s->id, ENT_QUOTES, 'UTF-8') . "_name');<br>";
         $sqlm .= "insert into `Message` values (" . $i . ",'es','" . htmlentities($s->name, ENT_QUOTES, 'UTF-8') . "');<br>";
         $sqlm .= "insert into `Message` values (" . $i++ . ",'en','');<br>";
         $sqlsm .= "insert into `SourceMessage` values (" . $i . ",'services','services_" . htmlentities($s->id, ENT_QUOTES, 'UTF-8') . "_description');<br>";
         $sqlm .= "insert into `Message` values (" . $i . ",'es','" . htmlentities($s->description, ENT_QUOTES, 'UTF-8') . "');<br>";
         $sqlm .= "insert into `Message` values (" . $i++ . ",'en','');<br>";
     }
     echo $sqlsm;
     echo $sqlm;
     echo "<br/>";
     $modules = Module::model()->findAll();
     $sqlsm = "";
     $sqlm = "";
     foreach ($modules as $s) {
         $sqlsm .= "insert into `SourceMessage` values (" . $i . ",'services','module_" . htmlentities($s->id, ENT_QUOTES, 'UTF-8') . "_name');<br>";
         $sqlm .= "insert into `Message` values (" . $i . ",'es','" . htmlentities($s->name, ENT_QUOTES, 'UTF-8') . "');<br>";
         $sqlm .= "insert into `Message` values (" . $i++ . ",'en','');<br>";
         $sqlsm .= "insert into `SourceMessage` values (" . $i . ",'services','module_" . htmlentities($s->id, ENT_QUOTES, 'UTF-8') . "_description');<br>";
         $sqlm .= "insert into `Message` values (" . $i . ",'es','" . htmlentities($s->description, ENT_QUOTES, 'UTF-8') . "');<br>";
         $sqlm .= "insert into `Message` values (" . $i++ . ",'en','');<br>";
     }
     echo $sqlsm;
     echo $sqlm;
     echo "<br/>";
     $departments = Department::model()->findAll();
     $sqlsm = "";
     $sqlm = "";
     $i = 157;
     foreach ($departments as $s) {
         $sqlsm .= "insert into `SourceMessage` values (" . $i . ",'departments','department_" . htmlentities($s->id, ENT_QUOTES, 'UTF-8') . "_name');<br>";
         $sqlm .= "insert into `Message` values (" . $i . ",'es','" . htmlentities($s->name, ENT_QUOTES, 'UTF-8') . "');<br>";
         $sqlm .= "insert into `Message` values (" . $i++ . ",'en','');<br>";
     }
     echo $sqlsm;
     echo $sqlm;
     echo "<br/>";
     $specialities = Speciality::model()->findAll();
     $sqlsm = "";
     $sqlm = "";
     foreach ($specialities as $s) {
         $sqlsm .= "insert into `SourceMessage` values (" . $i . ",'departments','speciality_" . htmlentities($s->id, ENT_QUOTES, 'UTF-8') . "_name');<br>";
         $sqlm .= "insert into `Message` values (" . $i . ",'es','" . htmlentities($s->name, ENT_QUOTES, 'UTF-8') . "');<br>";
         $sqlm .= "insert into `Message` values (" . $i++ . ",'en','');<br>";
     }
     echo $sqlsm;
     echo $sqlm;
     echo "<br/>";
     $news = News::model()->findAll();
     $sqlsm = "";
     $sqlm = "";
     $i = 229;
     foreach ($news as $s) {
         $sqlsm .= "insert into `SourceMessage` values (" . $i . ",'news','news_" . htmlentities($s->id, ENT_QUOTES, 'UTF-8') . "_title');<br>";
         $sqlm .= "insert into `Message` values (" . $i . ",'es','" . htmlentities($s->title, ENT_QUOTES, 'UTF-8') . "');<br>";
         $sqlm .= "insert into `Message` values (" . $i++ . ",'en','');<br>";
         $sqlsm .= "insert into `SourceMessage` values (" . $i . ",'news','news_" . htmlentities($s->id, ENT_QUOTES, 'UTF-8') . "_description');<br>";
         $sqlm .= "insert into `Message` values (" . $i . ",'es','" . htmlentities($s->description, ENT_QUOTES, 'UTF-8') . "');<br>";
         $sqlm .= "insert into `Message` values (" . $i++ . ",'en','');<br>";
     }
     echo $sqlsm;
     echo $sqlm;
     echo "<br/>";
     $doctors = Doctor::model()->findAll();
     $sqlsm = "";
     $sqlm = "";
     $i = 406;
     foreach ($doctors as $s) {
         $sqlsm .= "insert into `SourceMessage` values (" . $i . ",'doctors','doctor_" . htmlentities($s->id, ENT_QUOTES, 'UTF-8') . "_specialty');<br>";
         $sqlm .= "insert into `Message` values (" . $i . ",'es','" . htmlentities($s->specialism, ENT_QUOTES, 'UTF-8') . "');<br>";
         $sqlm .= "insert into `Message` values (" . $i++ . ",'en','');<br>";
         $sqlsm .= "insert into `SourceMessage` values (" . $i . ",'doctors','doctor_" . htmlentities($s->id, ENT_QUOTES, 'UTF-8') . "_fellowship');<br>";
         $sqlm .= "insert into `Message` values (" . $i . ",'es','" . htmlentities($s->fellowship, ENT_QUOTES, 'UTF-8') . "');<br>";
         $sqlm .= "insert into `Message` values (" . $i++ . ",'en','');<br>";
         $sqlsm .= "insert into `SourceMessage` values (" . $i . ",'doctors','doctor_" . htmlentities($s->id, ENT_QUOTES, 'UTF-8') . "_interests');<br>";
         $sqlm .= "insert into `Message` values (" . $i . ",'es','" . htmlentities($s->interests, ENT_QUOTES, 'UTF-8') . "');<br>";
         $sqlm .= "insert into `Message` values (" . $i++ . ",'en','');<br>";
     }
     echo $sqlsm;
     echo $sqlm;
     echo "<br/>";
     $sqlm = "";
     $con = mysqli_connect("166.63.0.204", "webcont_dba", "lN_Q*PR]FN[E", "webcont_hm");
     // Check connection
     if (mysqli_connect_errno()) {
         echo "Failed to connect to MySQL: " . mysqli_connect_error();
     }
     $result = mysqli_query($con, "SELECT id_mdc, especialidad_mdc, fellowship_mdc, intereses_mdc FROM medicos");
     $j = 406;
     while ($row = mysqli_fetch_array($result)) {
         $sqlm .= "update `Message` set translation='" . $row['fellowship_mdc'] . "' where id=" . $j++ . " and language='en';<br>";
         $sqlm .= "update `Message` set translation='" . $row['especialidad_mdc'] . "' where id=" . $j++ . " and language='en';<br>";
         $sqlm .= "update `Message` set translation='" . $row['intereses_mdc'] . "' where id=" . $j++ . " and language='en';<br>";
     }
     mysqli_close($con);
     echo $sqlm;
     echo "<br/>";
     $firstaids = FirstAid::model()->findAll();
     $sqlsm = "";
     $sqlm = "";
     $i = 1263;
     foreach ($firstaids as $s) {
         $sqlsm .= "insert into `SourceMessage` values (" . $i . ",'firstaid','" . htmlentities($s->id, ENT_QUOTES, 'UTF-8') . "_title');<br>";
         $sqlm .= "insert into `Message` values (" . $i . ",'es','" . htmlentities($s->title, ENT_QUOTES, 'UTF-8') . "');<br>";
         $sqlm .= "insert into `Message` values (" . $i++ . ",'en','');<br>";
         $sqlsm .= "insert into `SourceMessage` values (" . $i . ",'firstaid','" . htmlentities($s->id, ENT_QUOTES, 'UTF-8') . "_description');<br>";
         $sqlm .= "insert into `Message` values (" . $i . ",'es','" . htmlentities($s->description, ENT_QUOTES, 'UTF-8') . "');<br>";
         $sqlm .= "insert into `Message` values (" . $i++ . ",'en','');<br>";
     }
     echo $sqlsm;
     echo $sqlm;
 }