Exemple #1
0
 public function executeListCustom(sfWebRequest $request)
 {
     $q = Doctrine_core::getTable('Report')->getCustomReportsByUserQuery($request->getParameterHolder()->getAll());
     $this->pager = new sfDoctrinePager('Report', sfConfig::get('app_report_max_on_list'));
     $this->pager->setQuery(Doctrine_core::getTable('Report')->getCustomReportsByUserQuery($request->getParameterHolder()->getAll()));
     $this->pager->setPage($request->getParameter('page', 1));
     $this->pager->init();
 }
 function executeGlobal_order_by(sfWebRequest $request)
 {
     $this->order_by_date = "asc";
     $this->order_by_clickback = "";
     if ($od = $request->getParameter("od", null)) {
         $this->order_by_clickback = "";
         $this->order_by_date = $od;
     } elseif ($oc = $request->getParameter("oc", null)) {
         $this->order_by_clickback = $oc;
         $this->order_by_date = "";
     }
     $params = $request->getParameterHolder();
     $params = (array) $params->getAll();
     unset($params['module']);
     unset($params['action']);
     unset($params['od']);
     unset($params['oc']);
     $oc_params = $params;
     if ($this->order_by_clickback == "" || $this->order_by_clickback == "asc") {
         $oc_params['oc'] = "desc";
     } else {
         $oc_params['oc'] = "asc";
     }
     $od_params = $params;
     if ($this->order_by_date == "" || $this->order_by_date == "asc") {
         $od_params['od'] = "desc";
     } else {
         $od_params['od'] = "asc";
     }
     $this->oc_query = http_build_query($oc_params);
     $this->od_query = http_build_query($od_params);
 }
 /**
  * Executes index action
  *
  * @param sfRequest $request A request object
  */
 public function executeIndex(sfWebRequest $request)
 {
     $this->form = new ProfileForm();
     $this->getProFileMySelf();
     $this->getProfile($this->profileMySelf['profile']['m_id']);
     if ($request->isMethod('get')) {
         foreach ($this->profile as $value) {
             if ($value['m_id']) {
                 $this->form->setDefault('name', $value['name']);
                 $this->form->setDefault('age', str_replace("代", "", $value['age']));
                 $this->form->setDefault('gender', $this->convertGender($value['gender']));
                 $this->form->setDefault('introduction', $value['introduction']);
                 $this->form->setDefault('from1', $value['from1']);
                 $this->form->setDefault('from2', $value['from2']);
                 $this->form->setDefault('from3', $value['from3']);
                 $this->form->setDefault('from4', $value['from4']);
                 $this->form->setDefault('from5', $value['from5']);
                 $this->form->setDefault('to1', $value['to1']);
                 $this->form->setDefault('to2', $value['to2']);
                 $this->form->setDefault('to3', $value['to3']);
                 $this->form->setDefault('to4', $value['to4']);
                 $this->form->setDefault('to5', $value['to5']);
             }
         }
     }
     if ($request->isMethod('post')) {
         $this->form->bind($request->getParameterHolder()->getAll());
         if ($this->form->isValid()) {
             $this->updateProfile($request);
         }
         if ($this->form->isValid()) {
             $this->setTemplate('submit');
         }
     }
 }
 public function executeRemote(sfWebRequest $request)
 {
   
   $paramsArr = $request->getParameterHolder()->getAll();
   if (empty($paramsArr['form']) || empty($paramsArr['validator'])) {
     return sfView::NONE;
   }
   extract($paramsArr);
   $params = array();
   foreach ($paramsArr as $val) {
     if (is_array($val)) {
       $params = $val;
       break;
     }
   }
   $formObj = new $form();
   switch ($validator) {
     case 'sfValidatorDoctrineUnique':
     case 'sfValidatorPropelUnique':
       $validatorObj = new $validator(array('model' => $formObj->getModelName(), 'column' => array_keys($params)));
       $this->result = 'true';
       try {
         $validatorObj->clean($params);
       } catch (Exception $e) {
         $this->result = 'false';
       }
       $this->renderText($this->result);
       break;
   }
   return sfView::NONE;
 }  
 /**
  * Executes proximoBloque action
  *
  * @param sfRequest $request A request object
  */
 public function executeGuardarInstrumento(sfWebRequest $request)
 {
     $this->BD_Conectar();
     $idUser = $this->getUser()->getGuardUser()->getId();
     $this->idEncuestado = $request->getParameter('idEncuestado');
     /*si no llega el parametro idEncuestado entonces tirar un error 404*/
     $this->forward404If(!$this->idEncuestado);
     $arrayRespuestas = $request->getParameterHolder()->getAll();
     $sql_borrarcheckbooks = "DELETE FROM IRNC_respuestas WHERE `IRNC_respuestas`.`id_user` = '{$idUser}' AND `IRNC_respuestas`.`id_encuestado` = '{$this->idEncuestado}' AND `IRNC_respuestas`.`id_pregunta_IRNC` >= 43";
     mysql_query($sql_borrarcheckbooks);
     $sql_borrarCOMENTARIOScheckbooks = "DELETE FROM IRNC_respuestas_fixed_comxbloque WHERE `IRNC_respuestas_fixed_comxbloque`.`id_user` = '{$idUser}' AND `IRNC_respuestas_fixed_comxbloque`.`id_encuestado` = '{$this->idEncuestado}'";
     mysql_query($sql_borrarCOMENTARIOScheckbooks);
     foreach ($arrayRespuestas as $r_nombre_parametro => $r_valor_parametro) {
         if (substr($r_nombre_parametro, 0, strlen("radio_VorF_IRNC_")) == "radio_VorF_IRNC_") {
             //INICIO
             $id_preg = substr($r_nombre_parametro, strlen("radio_VorF_IRNC_"), strlen($r_nombre_parametro));
             $valRespuesta = $r_valor_parametro;
             $this->sql_update_or_insert_respuesta = $sql_chequear_siexisterespuesta = "select count(*) from IRNC_respuestas\nwhere\n\t`id_user`='{$idUser}' AND\n\t`id_encuestado`='{$this->idEncuestado}' AND\n\t`id_pregunta_IRNC`='{$id_preg}'";
             $respExiste = mysql_query($sql_chequear_siexisterespuesta);
             $respExiste = mysql_fetch_array($respExiste);
             // ECHO "EL IF DIJO ->".$respExiste[0]."<-";
             if ($respExiste[0] > 0) {
                 // si la respuesta a la pregunta estaba registrada entonces actualizo la respuesta
                 $this->sql_regustrar_respuesta = "\nUPDATE IRNC_respuestas\n\t SET\n\t\t`respuesta` = '{$valRespuesta}',\n\t\t`comentario` = '{$arrayRespuestas["comentario_{$id_preg}"]}' \n\t WHERE\n\t\t`IRNC_respuestas`.`id_user`='{$idUser}' AND\n\t\t`IRNC_respuestas`.`id_encuestado`='{$this->idEncuestado}' AND\n\t\t`IRNC_respuestas`.`id_pregunta_IRNC` ='{$id_preg}';";
             } else {
                 //si la respuesta a la pregunta no estaba registrada entonces la registro como nueva
                 $this->sql_regustrar_respuesta = "\n      INSERT INTO `IRNC_respuestas` (\n              `id_user` ,\n              `respuesta` ,\n              `comentario` ,\n              `id_encuestado` ,\n              `id_pregunta_IRNC`\n            )\n            VALUES (\n              '{$idUser}', '{$valRespuesta}', '{$arrayRespuestas["comentario_{$id_preg}"]}', '{$this->idEncuestado}', '{$id_preg}')";
             }
             //  echo $this->sql_regustrar_respuesta;
             mysql_query($this->sql_regustrar_respuesta);
         }
         // <| fiiiin>
         //****************************
         if (substr($r_nombre_parametro, 0, strlen("check_VorF_IRNC_")) == "check_VorF_IRNC_") {
             //INICIO
             $id_preg = substr($r_nombre_parametro, strlen("check_VorF_IRNC_"), strlen($r_nombre_parametro));
             $valRespuesta = $r_valor_parametro;
             //si la respuesta a la pregunta no estaba registrada entonces la registro como nueva
             $sql_regustrar_respuesta = "\n      INSERT INTO `IRNC_respuestas` (\n              `id_user` ,\n              `respuesta` ,\n              `comentario` ,\n              `id_encuestado` ,\n              `id_pregunta_IRNC`\n            )\n            VALUES (\n              '{$idUser}', '{$valRespuesta}', '{$arrayRespuestas["check_VorF_IRNComfix_{$id_preg}"]}', '{$this->idEncuestado}', '{$id_preg}')";
             // echo $sql_regustrar_respuesta;
             mysql_query($sql_regustrar_respuesta);
         }
         // <| fiiiin>
         //****************************
         if (substr($r_nombre_parametro, 0, strlen("comentario_bloque")) == "comentario_bloque") {
             //INICIO
             $num_bloque = substr($r_nombre_parametro, strlen("comentario_bloque"), strlen($r_nombre_parametro));
             $valRespuesta = $r_valor_parametro;
             //si la respuesta a la pregunta no estaba registrada entonces la registro como nueva
             $sql_regustrar_respuesta_cometariosfixed = "\n      INSERT INTO `IRNC_respuestas_fixed_comxbloque` (\n              `id_user` ,\n              `comentario` ,\n              `id_encuestado` ,\n              `bloque_IRNC`\n            )\n            VALUES (\n              '{$idUser}', '{$valRespuesta}', '{$this->idEncuestado}', '{$num_bloque}')";
             //echo $sql_regustrar_respuesta_cometariosfixed;
             mysql_query($sql_regustrar_respuesta_cometariosfixed);
         }
         // <| fiiiin>
         //****************************
     }
     if ($request->getParameter('esCerrarForm') == "CERRAR") {
         $this->forwardIf($this->getPorcentajeCompletadoIRNC($idUser, $this->idEncuestado) >= 100, $this->getModuleName(), 'cerrarInstrumento');
     }
 }
Exemple #6
0
 public function executeRemote(sfWebRequest $request)
 {
     $paramsArr = $request->getParameterHolder()->getAll();
     if (empty($paramsArr['form']) || empty($paramsArr['validator'])) {
         return sfView::NONE;
     }
     extract($paramsArr);
     $params = array();
     foreach ($paramsArr as $val) {
         if (is_array($val)) {
             $params = $val;
             break;
         }
     }
     $formObj = new $form();
     //validator per field
     if (isset($column)) {
         $formObj instanceof FRegistrationForm;
         $vs = $formObj->getValidatorSchema();
         $this->clean($vs[$column], $params[$column]);
         //post validators
     } else {
         switch ($validator) {
             case 'sfValidatorDoctrineUnique':
             case 'sfValidatorPropelUnique':
                 $this->clean(new $validator(array('model' => $formObj->getModelName(), 'column' => array_keys($params))), $params);
                 break;
         }
     }
     return sfView::NONE;
 }
 /**
  * Guarda todos las variables del array asociativo $request una tabla especifica de la BD
  * como parte de cada registro se agrega si esta consulta se hizo en modo pareado,
  * pareado se refiere a que la respuesta fue generada por dos personas sin emabrgo se identificaron como un idUser
  * por lo tanto luego se puede consultar cual era el co-evaluador asociado al encuestado y hacer los calculos
  *  mmm... ni yo me entiendo mucho que digamos, pero bueno..
  * 
  * $concensoMode =1 Si se esta guardando en modo consenso , 0 en caso contrario
  * @return boolean $saveState 'retorna un bool que dice si se guardo o no esta cosa'
  */
 public function GuardarInstrumento(sfWebRequest $request, $nombretabla, $concensoMode = 0)
 {
     $this->BD_Conectar();
     $idUser = $this->getUser()->getGuardUser()->getId();
     // $request->$request->getPostParameters();
     $this->idEncuestado = $request->getParameter('idEncuestado');
     $this->forward404If(!$this->idEncuestado);
     $this->concensoMode = $concensoMode;
     $arrayRespuestas = $request->getParameterHolder()->getAll();
     $elementosAIgnorar = sfConfig::get('app_supercontrolador_blacklist_' . $this->moduleName);
     $habraalgo = "SELECT * FROM `{$nombretabla}` WHERE `id_user`={$idUser} AND `id_encuestado`={$this->idEncuestado} AND `concensoMode`={$this->concensoMode} LIMIT 1";
     $result = mysql_query($habraalgo);
     $rows = mysql_num_rows($result);
     $sqlGuardar = null;
     if ($rows > 0) {
         $sqlGuardar = "";
         foreach ($arrayRespuestas as $idelement => $value) {
             if (!in_array($idelement, $elementosAIgnorar)) {
                 $sqlGuardar = "UPDATE {$nombretabla} SET `respuesta` = '" . mysql_real_escape_string($value) . "' WHERE `{$nombretabla}`.`id_respuesta` = '" . mysql_real_escape_string($idelement) . "' AND `{$nombretabla}`.`id_user` =" . (int) mysql_real_escape_string($idUser) . " AND `{$nombretabla}`.`id_encuestado` =" . (int) mysql_real_escape_string($this->idEncuestado) . " AND `{$nombretabla}`.`concensoMode` =" . (int) mysql_real_escape_string($this->concensoMode) . " LIMIT 1;";
             }
             mysql_query($sqlGuardar);
         }
     } else {
         $sqlGuardar = "";
         foreach ($arrayRespuestas as $idelement => $value) {
             if (!in_array($idelement, $elementosAIgnorar)) {
                 $sqlGuardar = "INSERT INTO {$nombretabla} (id_respuesta ,respuesta,id_user,id_encuestado,concensoMode) VALUES (\n\t\t\t\t'" . mysql_real_escape_string($idelement) . "', \n\t\t\t\t'" . mysql_real_escape_string($value) . "', \n\t\t\t\t'" . mysql_real_escape_string($idUser) . "', \n\t\t\t\t'" . mysql_real_escape_string($this->idEncuestado) . "', \n\t\t\t\t'" . mysql_real_escape_string($this->concensoMode) . "' );";
             }
             mysql_query($sqlGuardar);
         }
     }
     /*retorna true si todo OK*/
     return true;
     //puro chamullo, hay que buscar en la doc de php.net y ver si yo esoy casi seguro que el mysql_query retorna un estado parece, ese hay que usar para retornaar true o false aqui
 }
 /**
  * Executes proximoBloque action
  *
  * @param sfRequest $request A request object
  */
 public function executeProximoBloque(sfWebRequest $request)
 {
     $this->BD_Conectar();
     $idUser = $this->getUser()->getGuardUser()->getId();
     $this->idEncuestado = $request->getParameter('idEncuestado');
     /*si no llega el parametro idEncuestado entonces tirar un error 404*/
     $this->forward404If(!$this->idEncuestado);
     //$idEncuestado=12;
     //$idUser=124;
     $arrayRespuestas = $request->getParameterHolder()->getAll();
     $SQL_INSERTAR_RESPUESTAS = "";
     foreach ($arrayRespuestas as $r_nombre_parametro => $r_valor_parametro) {
         if (substr($r_nombre_parametro, 0, strlen("radio_VorF_SQIFA_")) == "radio_VorF_SQIFA_") {
             $id_preg = substr($r_nombre_parametro, strlen("radio_VorF_SQIFA_"), strlen($r_nombre_parametro));
             $valRespuesta = $r_valor_parametro;
             $sql_insert_respuesta = "INSERT INTO SQIFA_respuestas (\n        `id_user` ,\n        `respuesta` ,\n        `comentario` ,\n        `id_encuestado` ,\n        `id_pregunta_SQIFA`\n      )\n      VALUES (\n        '{$idUser}', '{$valRespuesta}', '{$arrayRespuestas["comentario_{$id_preg}"]}', '{$this->idEncuestado}', '{$id_preg}');";
             $SQL_INSERTAR_RESPUESTAS = $SQL_INSERTAR_RESPUESTAS . $sql_insert_respuesta;
             mysql_query($sql_insert_respuesta);
         }
     }
     //echo $SQL_INSERTAR_RESPUESTAS;
     // mysql_query("");
     /* echo "uAAA".$estado_grabacionformulario."BBBu";
       if($estado_grabacionformulario){
         $this->forward('SQIFA', 'listarBloque');
       }else{
        return sfView::ERROR;
       }*/
     $this->forward('SQIFA', 'listarBloque');
 }
 public function execute(sfWebRequest $request)
 {
     if ($request->isMethod('post')) {
         $this->getTimesheetForm()->bind($request->getParameterHolder()->getAll());
         if ($request->getParameter('btnSave')) {
             if ($this->numberOfRows == null) {
                 $this->getTimesheetService()->saveTimesheetItems($request->getParameter('initialRows'), 1, 1, $this->currentWeekDates, $this->totalRows);
                 $this->messageData = array('SUCCESS', __(TopLevelMessages::SAVE_SUCCESS));
                 $this->redirect('time/editTimesheet');
             } else {
                 $this->getTimesheetService()->saveTimesheetItems($request->getParameter('initialRows'), $this->employeeId, $this->timesheetId, $this->currentWeekDates, $this->totalRows);
                 $this->messageData = array('SUCCESS', __(TopLevelMessages::SAVE_SUCCESS));
                 $this->redirect('time/editTimesheet');
             }
         }
         if ($request->getParameter('btnRemoveRows')) {
             if ($this->numberOfRows == null) {
                 $this->messageData = array('WARNING', __("Can not delete an empty row"));
                 $this->redirect('time/editTimesheet');
             } else {
                 $this->getTimesheetService()->deleteTimesheetItems($request->getParameter('initialRows'), $this->employeeId, $this->timesheetId);
                 $this->messageData = array('SUCCESS', __(TopLevelMessages::DELETE_SUCCESS));
                 $this->redirect('time/editTimesheet');
             }
         }
     }
 }
 /**
  * Executes proximoBloque action
  *
  * @param sfRequest $request A request object
  */
 public function executeProximoBloquePart2CACSA(sfWebRequest $request)
 {
     $this->BD_Conectar();
     $idUser = $this->getUser()->getGuardUser()->getId();
     $this->idEncuestado = $request->getParameter('idEncuestado');
     /*si no llega el parametro idEncuestado entonces tirar un error 404*/
     $this->forward404If(!$this->idEncuestado);
     $arrayRespuestas = $request->getParameterHolder()->getAll();
     $SQL_INSERTAR_RESPUESTAS = "";
     foreach ($arrayRespuestas as $r_nombre_parametro => $r_valor_parametro) {
         if (substr($r_nombre_parametro, 0, strlen("radio_VorF_CACSA_")) == "radio_VorF_CACSA_") {
             $id_preg = substr($r_nombre_parametro, strlen("radio_VorF_CACSA_"), strlen($r_nombre_parametro));
             $valRespuesta = $r_valor_parametro;
             $valRespuesta1 = $request->getParameter('radio_VorF_CACSA_' . $id_preg);
             $valRespuesta2 = $request->getParameter('respuesta2_CACSA_' . $id_preg);
             $valRespuesta3 = $request->getParameter('radio_respuesta3_CACSA_' . $id_preg);
             $sql_insert_respuesta = "INSERT INTO CACSA3_respuestas (\n        `id_user` ,\n        `respuesta` ,\n        `comentario` ,\n        `id_encuestado` ,\n        `id_pregunta_CACSA3`\n      )\n      VALUES (\n        '{$idUser}', '{$valRespuesta}', '', '{$this->idEncuestado}', '{$id_preg}');";
             // GL: en el insert en comentario estaba {$arrayRespuestas["comentario_{$id_preg}"]} pero lo quite porque ya no es encesario
             $SQL_INSERTAR_RESPUESTAS = $SQL_INSERTAR_RESPUESTAS . $sql_insert_respuesta;
             mysql_query($sql_insert_respuesta);
         }
     }
     $this->porcCompletado = $this->getPorcentajeCompletadoPart2CACSA($idUser, $this->idEncuestado);
     $this->forward('CACSA', 'showPart2CACSA');
 }
 public function executeIndex(sfWebRequest $request)
 {
     if ($this->memberExist()) {
         $this->setTemplate('exist');
         return sfView::SUCCESS;
     }
     $this->form = new MemberForm();
     if ($request->isMethod('get')) {
         $mixi = new MixiAppMobileApi();
         $person = $mixi->get(sfConfig::get('sf_opensocial_person_api') . '?fields=birthday,gender');
         $this->form->setDefault('name', $person->entry->nickname);
         $this->form->setDefault('gender', $this->convertGender($person->entry->gender));
         $this->form->setDefault('age', $this->convertAge($person->entry->birthday));
     }
     if ($request->isMethod('post')) {
         $this->form->bind($request->getParameterHolder()->getAll());
         if ($this->getRequestParameter('adjustment') == '' && $this->form->isValid()) {
             $this->display_gender = MemberForm::$sexs[$this->getRequestParameter('gender')];
             //var_dump(MemberForm::$sexs[$this->getRequestParameter('gender')]);
             //$this->display_form = MemberForm::$sexs[$this->getRequestParameter('gender')];
             $this->form->freeze();
             $this->setTemplate('confirm');
         }
     }
     return sfView::SUCCESS;
 }
 public function executeList(sfWebRequest $request)
 {
     //mixiサーバから値取得
     if ($request->isMethod('get')) {
         $mixi = new MixiAppMobileApi();
         $persistence = $mixi->get(sfConfig::get('sf_opensocial_persistence_api'));
         $mixi_persistence = $persistence->entry->{'mixi.jp:' . MixiAppMobileApi::$ownerId};
         $request->setParameter('to_address', $mixi_persistence->to_address);
         $request->setParameter('to_lon', $mixi_persistence->to_lon);
         $request->setParameter('to_lat', $mixi_persistence->to_lat);
         $request->setParameter('from_address', $mixi_persistence->from_address);
         $request->setParameter('from_lon', $mixi_persistence->from_lon);
         $request->setParameter('from_lat', $mixi_persistence->from_lat);
         $request->setParameter('category', $mixi_persistence->category);
         $request->setParameter('depart_date', array('year' => $mixi_persistence->depart_year, 'month' => $mixi_persistence->depart_month, 'day' => $mixi_persistence->depart_day));
         $request->setParameter('depart_time', array('hour' => $mixi_persistence->depart_hour, 'minute' => $mixi_persistence->depart_min));
     } else {
         if ($request->isMethod('post')) {
             //mixiサーバに値設定
             $depart_date = $this->getRequestParameter('depart_date');
             $depart_time = $this->getRequestParameter('depart_time');
             $mixi = new MixiAppMobileApi();
             $mixi->post(sfConfig::get('sf_opensocial_persistence_api'), array('to_address' => $this->getRequestParameter('to_address'), 'to_lon' => $this->getRequestParameter('to_lon'), 'to_lat' => $this->getRequestParameter('to_lat'), 'from_address' => $this->getRequestParameter('from_address'), 'from_lon' => $this->getRequestParameter('from_lon'), 'from_lat' => $this->getRequestParameter('from_lat'), 'category' => $this->getRequestParameter('category'), 'depart_year' => $depart_date['year'], 'depart_month' => $depart_date['month'], 'depart_day' => $depart_date['day'], 'depart_hour' => $depart_time['hour'], 'depart_min' => $depart_time['minute']));
         }
     }
     //タクトモAPIにアクセス
     $this->form = new SearchDriverForm();
     $b = new sfWebBrowser();
     $this->from_address = $this->getRequestParameter('from_address');
     $this->to_address = $this->getRequestParameter('to_address');
     $this->form->bind($request->getParameterHolder()->getAll());
     if ($this->form->isValid()) {
         $this->display_category = SearchDriverForm::$categories[$this->getRequestParameter('category')];
         $depart_date = $this->getRequestParameter('depart_date');
         $depart_time = $this->getRequestParameter('depart_time');
         $b->post(sfConfig::get('sf_takutomo_search_driver_url'), array('from_address' => $this->getRequestParameter('from_address'), 'from_lat' => $this->getRequestParameter('from_lat'), 'from_lon' => $this->getRequestParameter('from_lon'), 'to_address' => $this->getRequestParameter('to_address'), 'to_lat' => $this->getRequestParameter('to_lat'), 'to_lon' => $this->getRequestParameter('to_lon'), 'depart_date' => $depart_date['year'] . sprintf('%02d', $depart_date['month']) . sprintf('%02d', $depart_date['day']), 'depart_hour' => $depart_time['hour'], 'depart_min' => sprintf('%02d', $depart_time['minute']), 'category' => $this->display_category));
         $xml = new SimpleXMLElement($b->getResponseText());
         //print $b->getResponseText();
         //print((string)$xml->status->code);
         if ((int) $xml->status->code >= 1000) {
             $this->form->getErrorSchema()->addError(new sfValidatorError(new sfValidatorPass(), (string) $xml->status->description));
             $this->setTemplate('index');
         } else {
             //xmlを連想配列に変換
             $options = array('complexType' => 'array');
             // print $b->getResponseText();
             $Unserializer = new XML_Unserializer($options);
             $status = $Unserializer->unserialize($b->getResponseText());
             if ($status === true) {
                 $this->list = $Unserializer->getUnserializedData();
                 //print_r($this->list);
             }
         }
         $this->display_description = (string) $xml->status->description;
     } else {
         $this->setTemplate('index');
         //$this->forward("search_driver", "index");
     }
 }
 public function executeSave_nested_set(sfWebRequest $request)
 {
     $this->getContext()->getLogger()->log(var_export($request->getParameterHolder()->getAll(), true));
     $data = $request->getParameterHolder()->getAll();
     foreach ($data as $key => $value) {
         if (strpos($key, 'sf_admin_nested_set_') !== false) {
             $items = $value['items'];
             foreach ($items as $item) {
                 if (isset($item['children'])) {
                     $this->_saveChildren($request->getParameter('model'), $item['id'], $item['children']);
                 }
             }
         }
     }
     $this->clearCache();
     return sfView::NONE;
 }
Exemple #14
0
 public function executeCreate(sfWebRequest $request)
 {
     $this->forward404Unless($request->isMethod(sfRequest::POST));
     $parameters = $request->getParameterHolder()->get('revision');
     $this->procedure = Doctrine::getTable('Procedure')->find($parameters['procedure_id']);
     $this->form = new FrontRevisionForm();
     $this->processForm($request, $this->form);
     $this->setTemplate('new');
 }
Exemple #15
0
 /**
  * Executes index action
  *
  * @param sfWebRequest $request A request object
  */
 public function executeIndex(sfWebRequest $request)
 {
     $themeSearcher = new opThemeAssetSearcher();
     $this->themeName = $request->getParameterHolder()->get('theme_name');
     if (null === $this->themeName) {
         $this->forward404('Request parameter id does not exist.');
     }
     $this->isExistsTheme = $themeSearcher->isAvailableTheme($this->themeName);
     $this->emptyThemeName = $this->themeName === null;
 }
 public function executeChiaraRedirector(sfWebRequest $request)
 {
     $pathInfo = str_replace('Chiara_PEAR_Server_REST', 'pluginRest', $request->getPathInfo());
     $routing = sfContext::getInstance()->getRouting();
     $parameter = $routing->parse($pathInfo);
     $request->setAttribute('sf_route', $parameter['_sf_route']);
     unset($parameter['_sf_route']);
     $parameterHolder = $request->getParameterHolder();
     $parameterHolder->add($parameter);
     $this->forward($parameter['module'], $parameter['action']);
 }
 /**
  * Executes index action
  *
  * @param sfRequest $request A request object
  */
 public function executeIndex(sfWebRequest $request)
 {
     $this->form = new InquiryForm();
     if ($request->isMethod('post')) {
         $this->form->bind($request->getParameterHolder()->getAll());
         if ($this->getRequestParameter('adjustment') == '' && $this->form->isValid()) {
             $this->form->freeze();
             $this->setTemplate('confirm');
         }
     }
 }
Exemple #18
0
 /**
  * Executes index action
  *
  * @param sfRequest $request A request object
  */
 public function executeRegister(sfWebRequest $request)
 {
     $a = $this->getUser()->getAttributeHolder()->getAll();
     $b = $request->getParameterHolder()->getAll();
     $this->forward404Unless($client = Doctrine::getTable('Client')->find($request->getParameter('user_id')));
     if ($client->email_confirmed) {
         $this->setTemplate('duplicate');
     } else {
         $client->email_confirmed = true;
         $client->save();
         $this->reservation = $client->Reservations[0];
     }
 }
Exemple #19
0
 public function executeGlobal(sfWebRequest $request)
 {
     $yiid_activity = MongoManager::getDM()->getRepository('Documents\\YiidActivity');
     $params = $request->getParameterHolder()->getAll();
     $activities = $yiid_activity->findByQuery($params);
     $max_activities = $yiid_activity->countByQuery($params);
     $pager = new ArrayPager();
     $pager->setMax($max_activities);
     $pager->setResultArray($activities);
     $pager->setPage($request->getParameter("p", 1));
     $pager->init();
     $this->activities = $pager;
 }
Exemple #20
0
 protected function processForm(sfWebRequest $request, sfForm $form, $editable = true)
 {
     $formValues = array();
     $requestParameters = $request->getParameterHolder()->getAll();
     $formValues = sfMmwExtjsUtil::getSfParamsFromExtjs('structures', $requestParameters);
     $formValues = $this->prepareFormValues($formValues, $form);
     $files = $this->getSfFilesParamsFromExtjs($_FILES, $form->getName());
     //$form->bind($request->getParameter($form->getName()), $request->getFiles($form->getName()));
     $fieldsToPost = json_decode($requestParameters['fields']);
     foreach ($this->form->getWidgetSchema()->getFields() as $fieldname => $widget) {
         if (!in_array(sfMmwExtjsUtil::getSfExtjsNameFromField('structures', $fieldname), $fieldsToPost)) {
             unset($form[$fieldname]);
         }
     }
     $form->bind($formValues, $files);
     if ($form->isValid()) {
         //$this->getUser()->setFlash('notice', $form->getObject()->isNew() ? 'The item was created successfully.' : 'The item was updated successfully.');
         $this->json['success'] = true;
         $this->json['data'] = false;
         $structures = $form->save();
         $this->prepareJsonValues($form);
         $data_array = $structures->toArray();
         $data_array = array_merge($data_array, $structures->getMatFinsAndFinitions());
         if (is_array($this->json['data'])) {
             $this->json['data'] = array_merge($this->json['data'], sfMmwExtjsUtil::getExtjsParamsfromArray('structures', $data_array));
         } else {
             $this->json['data'] = sfMmwExtjsUtil::getExtjsParamsfromArray('structures', $data_array);
         }
         if (!$editable) {
             $displayValues = $this->getFieldsValues($structures, false, true);
             foreach ($displayValues as $key => $displayValue) {
                 $this->json['data'][$key] = $displayValue;
             }
         }
         $this->dispatcher->notify(new sfEvent($this, 'admin.save_object', array('object' => $structures)));
     } else {
         //$this->getUser()->setFlash('error', 'The item has not been saved due to some errors.');
         $this->json['success'] = false;
         $this->json['data'] = false;
         if ($form->hasErrors()) {
             $this->json['errormsg'] = 'Data has not been saved';
             // set individual error field
             foreach ($form->getErrorSchema() as $field => $error) {
                 $this->json['errors'][sfMmwExtjsUtil::getSfExtjsNameFromField('structures', $field)] = $error->getMessage();
             }
         }
     }
     $this->setRequestParameter('json', $this->json);
     $this->forward($this->getModuleName(), 'jsonResponse');
 }
 /**
  * Executes index action
  *
  * @param sfRequest $request A request object
  */
 public function executeIndex(sfWebRequest $request)
 {
     $this->form = new ForgotPasswordForm();
     if ($request->isMethod('post')) {
         $this->form->bind($request->getParameterHolder()->getAll());
         if ($this->form->isValid()) {
             $b = new sfWebBrowser();
             $b->post(sfConfig::get('sf_takutomo_forgot_password_url'), array('email' => $this->getRequestParameter('email')));
             $xml = new SimpleXMLElement($b->getResponseText());
             $this->display_description = (string) $xml->status->description;
             $this->setTemplate('submit');
         }
     }
 }
 /**
  * Executes index action
  *
  * @param sfRequest $request A request object
  */
 public function executeIndex(sfWebRequest $request)
 {
     $this->form = new AddEventCommentForm();
     if ($request->isMethod('get')) {
         $this->form->setDefault('event_id', $request->getParameter('event_id'));
     } elseif ($request->isMethod('post')) {
         $this->form->bind($request->getParameterHolder()->getAll());
         if ($this->form->isValid()) {
             $b = new sfWebBrowser();
             $b->post(sfConfig::get('sf_takutomo_add_event_comment_url'), array('event_id' => $this->getRequestParameter('event_id'), 'comment' => $this->getRequestParameter('comment')));
             print $b->getResponseText();
         }
     }
 }
Exemple #23
0
 public function executePreview(sfWebRequest $request)
 {
     if (false === ($markdown = $request->getParameter('markdown_value', false))) {
         $field = $request->getParameter('markdown_field');
         $markdown = sfToolkit::getArrayValueForPath($request->getParameterHolder()->getAll(), $field, false);
         if ($markdown === false) {
             throw new sfException("Cannot generate preview: markdown value or markdown form field not found in request");
         }
     }
     $parser = new MarkdownExtra_Parser();
     // $this->markdown = $parser->transform($markdown);
     $markdown = $markdown ? $markdown : '_No Markdown To Preview!_';
     return $this->renderText($parser->transform($markdown));
 }
Exemple #24
0
 protected function processForm(sfWebRequest $request, sfForm $form)
 {
     $formValues = array();
     $requestParameters = $request->getParameterHolder()->getAll();
     $formValues = sfMmwExtjsUtil::getSfParamsFromExtjs('identification', $requestParameters);
     $formValues = $this->prepareFormValues($formValues, $form);
     $files = $this->getSfFilesParamsFromExtjs($_FILES, 'identification');
     //$form->bind($request->getParameter($form->getName()), $request->getFiles($form->getName()));
     $fieldsToPost = isset($requestParameters['fields']) ? json_decode($requestParameters['fields']) : null;
     foreach ($this->form->getWidgetSchema()->getFields() as $fieldname => $widget) {
         if (get_class($widget) != 'sfWidgetFormSchemaDecorator' && $fieldsToPost != null && !in_array(sfMmwExtjsUtil::getSfExtjsNameFromField('identification', $fieldname), $fieldsToPost)) {
             unset($form[$fieldname]);
         }
     }
     $form->bind($formValues, $files);
     if ($form->isValid()) {
         //$this->getUser()->setFlash('notice', $form->getObject()->isNew() ? 'The item was created successfully.' : 'The item was updated successfully.');
         $this->json['success'] = true;
         $this->json['data'] = false;
         $identification = $form->save();
         $this->prepareJsonValues($form);
         if (is_array($this->json['data'])) {
             $this->json['data'] = array_merge($this->json['data'], sfMmwExtjsUtil::getExtjsParamsfromArray('identification', $identification->toArray()));
         } else {
             $this->json['data'] = sfMmwExtjsUtil::getExtjsParamsfromArray('identification', $identification->toArray());
         }
         $this->dispatcher->notify(new sfEvent($this, 'admin.save_object', array('object' => $identification)));
     } else {
         //$this->getUser()->setFlash('error', 'The item has not been saved due to some errors.');
         $this->json['success'] = false;
         $this->json['data'] = false;
         if ($form->hasErrors()) {
             $this->json['errormsg'] = 'Data has not been saved';
             // set individual error field
             foreach ($form->getErrorSchema() as $field => $error) {
                 $this->json['errors'][sfMmwExtjsUtil::getSfExtjsNameFromField('identification', $field)] = $error->getMessage();
             }
         }
     }
     // SURCHARGE
     $secteurCommune = $identification->getSecteurCommune();
     if (!empty($secteurCommune)) {
         $this->json['data']['identification__secteur'] = $secteurCommune;
     }
     $this->json['list'] = $this->FormRelationsJsonEncode();
     // FIN SURCHARGE
     $this->setRequestParameter('json', $this->json);
     $this->forward($this->getModuleName(), 'jsonResponse');
 }
Exemple #25
0
 /**
  * Generic call action for all providers
  * 
  * @param sfWebRequest $request 
  * @return sfView::SUCCESS
  */
 public function executeCall(sfWebRequest $request)
 {
     $this->forward404Unless($request->getParameter('provider'));
     $this->forward404Unless($request->getParameter('method'));
     $config = sfConfig::get('app_cacophony');
     $this->forward404Unless(in_array($request->getParameter('provider'), array_keys($config['providers'])));
     $params = array();
     foreach ($request->getParameterHolder()->getAll() as $k => $p) {
         if (!in_array($k, array('method', 'action', 'module', 'provider'))) {
             $params[$k] = $p;
         }
     }
     $result = json_decode(sfCacophonyOAuth::call($request->getParameter('method'), $request->getParameter('provider'), $this->getUser()->getAttribute('accessToken', null, sprintf('sfCacophonyPlugin/%s', $request->getParameter('provider'))), $params));
     $this->setVar('result', $result, true);
 }
 /**
  * Executes index action
  *
  * @param sfRequest $request A request object
  */
 public function executeIndex(sfWebRequest $request)
 {
     $this->form = new LoginForm();
     if ($request->isMethod('post')) {
         $this->form->bind($request->getParameterHolder()->getAll());
         if ($this->form->isValid()) {
             $b = new sfWebBrowser();
             $b->post('http://api.takutomo.com/v3/member/get_profile_myself.php?api_key=pontuyo', array('email' => $this->getRequestParameter('email'), 'password' => $this->getRequestParameter('password')));
             print $b->getResponseText();
             $xml = new SimpleXMLElement($b->getResponseText());
             //var_dump(MemberForm::$sexs[$this->getRequestParameter('gender')]);
             //$this->display_form = MemberForm::$sexs[$this->getRequestParameter('gender')];
             //$this->form->freeze();
             //	$this->setTemplate('confirm');
         }
     }
 }
 private function addEventComment(sfWebRequest $request)
 {
     $b = new sfWebBrowser();
     $this->form = new AddEventCommentForm();
     $this->form->bind($request->getParameterHolder()->getAll());
     if ($this->form->isValid()) {
         $b = new sfWebBrowser();
         $b->post(sfConfig::get('sf_takutomo_add_event_comment_url'), array('guid' => 'mixi,' . MixiAppMobileApi::$ownerId, 'event_id' => $this->getRequestParameter('event_id'), 'comments' => $this->getRequestParameter('comment')));
         $xml = new SimpleXMLElement($b->getResponseText());
         if ((int) $xml->status->code >= 1000) {
             $this->form->getErrorSchema()->addError(new sfValidatorError(new sfValidatorPass(), (string) $xml->status->description));
         } else {
             $this->display_description = (string) $xml->status->description;
             $this->setTemplate('submit');
         }
     }
 }
Exemple #28
0
 /**
  * Executes index action
  *
  * @param sfRequest $request A request object
  */
 public function executeIndex(sfWebRequest $request)
 {
     $lUrl = $request->getParameter("url", null);
     $lUrl = UrlUtils::narmalizeUrlScheme($lUrl);
     $request->setParameter("url", $lUrl);
     $this->url = $lUrl;
     $this->error = $this->pError = null;
     if (!$lUrl) {
         return $this->setTemplate("share");
     }
     if ($request->getMethod() == "POST") {
         $lParams = $request->getParameter('like');
         $lParams['u_id'] = $this->getUser()->getUserId();
         $lActivity = new Documents\YiidActivity();
         $lActivity->fromArray($lParams);
         // try to save activity
         try {
             $lActivity->save();
             $this->redirect("@deal?url=" . urlencode($lUrl));
         } catch (Exception $e) {
             // send error on exception
             $this->getLogger()->err($e->getMessage());
             $this->pError = $e->getMessage();
         }
     }
     $dm = MongoManager::getDM();
     $this->pActivity = $dm->getRepository("Documents\\YiidActivity")->findOneBy(array("url" => $lUrl, "u_id" => intval($this->getUser()->getId()), "d_id" => array('$exists' => false)));
     // if user has already liked
     if ($this->pActivity) {
         $this->redirect("@deal?url=" . urlencode($lUrl));
     }
     $lYiidMeta = new YiidMeta();
     $lYiidMeta->fromParams($request->getParameterHolder());
     $this->pYiidMeta = SocialObjectParser::fetch($request->getParameter("url"), $lYiidMeta);
     if ($this->pYiidMeta === false) {
         $this->error = "the url '{$lUrl}' is not well formed!";
         return $this->setTemplate("share");
     }
     $domainProfile = DomainProfileTable::getInstance()->retrieveByUrl($lUrl);
     $this->trackingUrl = null;
     if ($domainProfile) {
         $this->trackingUrl = $domainProfile->getTrackingUrl();
     }
     $this->getResponse()->setSlot('js_document_ready', $this->getPartial('like/js_init_like.js', array('pImgCount' => count($this->pYiidMeta->getImages()), 'pUrl' => $request->getParameter("url"))));
 }
 /**
  * Executes proximoBloque action
  *
  * @param sfRequest $request A request object
  */
 public function executeProximoBloque(sfWebRequest $request)
 {
     $this->BD_Conectar();
     $idUser = $this->getUser()->getGuardUser()->getId();
     $this->idEncuestado = $request->getParameter('idEncuestado');
     /*si no llega el parametro idEncuestado entonces tirar un error 404*/
     $this->forward404If(!$this->idEncuestado);
     $arrayRespuestas = $request->getParameterHolder()->getAll();
     foreach ($arrayRespuestas as $r_nombre_parametro => $r_valor_parametro) {
         if (substr($r_nombre_parametro, 0, strlen("radio_VorF_JIR_")) == "radio_VorF_JIR_") {
             $id_preg = substr($r_nombre_parametro, strlen("radio_VorF_JIR_"), strlen($r_nombre_parametro));
             $valRespuesta = $r_valor_parametro;
             $sql_insert_respuesta = "INSERT INTO JIR_respuestas (\n        `id_user` ,\n        `respuesta` ,\n        `comentario` ,\n        `id_encuestado` ,\n        `id_pregunta_JIR`\n      )\n      VALUES (\n        '{$idUser}', '{$valRespuesta}', '{$arrayRespuestas["comentario_{$id_preg}"]}', '{$this->idEncuestado}', '{$id_preg}');";
             mysql_query($sql_insert_respuesta);
         }
     }
     $this->forward('JIR', 'listarBloque');
 }
 public function executeConfirm(sfWebRequest $request)
 {
     $this->form = new EditEmailForm();
     if ($request->isMethod('post')) {
         $this->form->bind($request->getParameterHolder()->getAll());
         $b = new sfWebBrowser();
         if ($this->form->isValid()) {
             $b->post(sfConfig::get('sf_takutomo_edit_email_url'), array('guid' => 'mixi,' . MixiAppMobileApi::$ownerId, 'new_email' => $this->getRequestParameter('new_email'), 'new_password' => $this->getRequestParameter('new_password')));
             $xml = new SimpleXMLElement($b->getResponseText());
             if ((int) $xml->status->code >= 1000) {
                 $this->form->getErrorSchema()->addError(new sfValidatorError(new sfValidatorPass(), (string) $xml->status->description));
             } else {
                 $this->display_description = (string) $xml->status->description;
                 $this->setTemplate('submit');
             }
         }
     }
 }