Ejemplo n.º 1
0
 /**
  * For listing the State
  * @author        Praveen Singh
  * @method        getState
  * @param         id
  * @return        one row of Module Role table 
  * @since         version 0.0.1
  * @version       0.2.9
  */
 function getState($statId)
 {
     App::import("Model", "State");
     $model = new State();
     $datas = $model->find("first", array('conditions' => array('State.id' => $statId)));
     return $datas;
 }
Ejemplo n.º 2
0
 public function initialize($entity = null, $options = null)
 {
     $country = new Select('countryid', Country::find(), array('using' => array('id', 'country'), 'useEmpty' => TRUE, 'emptyText' => $this->di->get('translate')->_('Seleccione un País')));
     $country->setLabel('País');
     $this->add($country);
     if (isset($entity)) {
         if ($entity->getCountryid()) {
             $state = new Select('stateid', State::find(array("columns" => array("id,state"), "conditions" => "countryid =:countryid:", "bind" => array("countryid" => $entity->countryid))), array("useEmpty" => true, "emptyText" => $this->di->get('translate')->_('Seleccione un Estado'), 'using' => array('id', 'state')));
             $state->setLabel('Estado');
             $this->add($state);
             $city = new Select('cityid', City::find(array("columns" => array("id,city"), "conditions" => "countryid =:countryid: AND stateid =:stateid: ", "bind" => array("countryid" => $entity->countryid, "stateid" => $entity->stateid))), array("useEmpty" => true, "emptyText" => $this->di->get('translate')->_('Seleccione una ciudad'), 'using' => array('id', 'city')));
             $city->setLabel('Ciudad');
             $this->add($city);
             $township = new Select('townshipid', Township::find(array("columns" => array("id,township"), "conditions" => "cityid =:cityid:", "bind" => array("cityid" => $entity->cityid))), array("useEmpty" => true, "emptyText" => $this->di->get('translate')->_('Seleccione un Sector'), 'using' => array('id', 'township')));
             $township->setLabel('Sector');
             $this->add($township);
             $neighborhood = new Select('neighborhoodid', Neighborhood::find(array("columns" => array("id,neighborhood"), "conditions" => "cityid =:cityid:", "bind" => array("cityid" => $entity->cityid))), array("useEmpty" => true, "emptyText" => $this->di->get('translate')->_('Seleccione un Barrio'), 'using' => array('id', 'neighborhood')));
             $neighborhood->setLabel('Barrio');
             $this->add($neighborhood);
         } else {
             $this->set_empty_values();
         }
     } else {
         $this->set_empty_values();
     }
     $address = new Textarea('address', array("maxlength" => "400"));
     $address->setLabel('Dirección');
     $this->add($address);
     $description = new Textarea('description', array("maxlength" => "100"));
     $description->setLabel('Descripción');
     $this->add($description);
 }
 /**
  * Display the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function show($id)
 {
     $state = State::find($id);
     if (!$state) {
         return $this->errorNotFound('state not found');
     }
     return $this->respondWithItem($state, new StateTransformer());
 }
Ejemplo n.º 4
0
 public function getStateList()
 {
     /* Start here set the country list */
     App::import("Model", "State");
     $state = new State();
     $options = array('fields' => array('State.id', 'State.state_name', 'State.is_deleted'));
     $getStateAllWithStatus = $state->find('all', $options);
     $newStateList = array();
     if ($state->find('count', $options) > 0) {
         foreach ($getStateAllWithStatus as $index => $value) {
             if ($value["State"]["is_deleted"] == "1") {
                 $newStateList[$value["State"]["id"]] = $value["State"]["state_name"] . " (Under Deleted)";
             } else {
                 $newStateList[$value["State"]["id"]] = $value["State"]["state_name"];
             }
         }
     }
     return $getCityList = $newStateList;
 }
Ejemplo n.º 5
0
 function getStateList($countryCode)
 {
     App::import("Model", "State");
     $model = new State();
     $con2 = $model->find('list', array('fields' => array('State.id', 'State.statename'), 'conditions' => array('State.countryid' => $countryCode)));
     if (empty($con2)) {
         return 0;
     } else {
         return $con2;
     }
 }
Ejemplo n.º 6
0
 public function initialize($entity = null, $options = null)
 {
     $country = new Select('countryid', Country::find(), array('using' => array('id', 'country'), 'useEmpty' => TRUE, 'emptyText' => 'Seleccione un País'));
     $country->setLabel('Pais');
     $this->add($country);
     if (isset($entity)) {
         $state = new Select('stateid', State::find(array("columns" => array("id,state"), "conditions" => "id = :id: OR countryid =:countryid:", "bind" => array("id" => $entity->stateid, "countryid" => $entity->countryid))), array("useEmpty" => true, "emptyText" => 'Seleccione un Estado', 'using' => array('id', 'state')));
         $state->setLabel('Estado');
         $this->add($state);
     } else {
         $state = new Select('stateid', array(), array('useEmpty' => TRUE, 'emptyText' => 'Seleccione un Estado'));
         $state->setLabel('Estado');
         $this->add($state);
     }
     //añadimos un botón de tipo submit
     $submit = $this->add(new Submit('Guardar', array('class' => 'btn btn-success')));
 }
Ejemplo n.º 7
0
 function GetStateSelectOList($SelectedId)
 {
     App::import('Model', 'State');
     $objState = new State();
     $this->State->recursive = -1;
     $arrData = $objState->find("all", array('order' => array('State.name' => 'ASC')));
     $selectOption = "";
     foreach ($arrData as $data) {
         if ($SelectedId == $data['State']['slug']) {
             $select = "selected='selected'";
         } else {
             $select = "";
         }
         $selectOption .= '<option value="' . $data['State']['slug'] . '" ' . $select . '>' . $data['State']['name'] . '</option>';
     }
     return $selectOption;
 }
Ejemplo n.º 8
0
 function eliminar($id)
 {
     $a = State::find($id);
     $a->delete();
     $this->session->set_flashdata('msg', '<div class="success">El provincia fué eliminada correctamente.</div>');
     redirect('provincias');
 }
Ejemplo n.º 9
0
 function addressMetaData($action)
 {
     //        $optionState = array();
     //        $optionState['order'] = array('state_name' => 'asc', 'active' => '1');
     //        $optionState['conditions'] = array('zone_id' => $address['zone_id'], 'active' => '1');
     if (isset($this->params['named']['copy_address']) || $action == 'edit' || $action == 'copy') {
         App::import('Model', 'Country');
         $objCountry = new Country();
         App::import('Model', 'Zone');
         $objZone = new Zone();
         App::import('Model', 'State');
         $objState = new State();
         App::import('Model', 'District');
         $objDistrict = new District();
         App::import('Model', 'City');
         $objCity = new City();
         $optionZone = array();
         $optionDistrict = array();
         $optionCity = array();
         if (!empty($this->viewVars[lcfirst($this->modelClass)]['Address'])) {
             $address = $this->viewVars[lcfirst($this->modelClass)]['Address'];
             $optionCountry['conditions'] = array('id' => $address['country_id'], 'active' => '1');
             $optionZone['conditions'] = array('id' => $address['zone_id'], 'active' => '1');
             $optionState['conditions'] = array('id' => $address['state_id'], 'active' => '1');
             $optionDistrict['conditions'] = array('id' => $address['district_id'], 'active' => '1');
             $optionCity['conditions'] = array('id' => $address['city_id'], 'active' => '1');
         }
         $countries = $objCountry->find('list', $optionCountry);
         $zones = $objZone->find('list', $optionZone);
         $states = $objState->find('list', $optionState);
         $districts = $objDistrict->find('list', $optionDistrict);
         $cities = $objCity->find('list', $optionCity);
         $this->set(compact('countries', 'zones', 'states', 'districts', 'cities'));
     }
 }
Ejemplo n.º 10
0
 public function getCities($idState)
 {
     if (Request::ajax()) {
         return State::find($idState)->cities;
     }
 }
Ejemplo n.º 11
0
 public function test3()
 {
     $user = User::find(1);
     $password = str_random(6);
     $school = School::find($user->school_id);
     $city = City::find($user->city_id);
     $state = State::find($city->state_id);
     $name = "Aneesh Dash";
     $to = "Aneesh Dash<*****@*****.**>";
     $subject = "Technothlon Registration Details";
     $message = "\n        <html lang='en'>\n        <head>\n    <meta charset='UTF-8'>\n    <title>Technothlon Registration Details</title>\n    </head>\n    <body>\n    <div style='display: table; margin: 0 auto'>\n    <div style='text-align: center'>\n        <img src='technothlon.png'; width='300px'>\n    </div><br><br>\n    <div style='display: inline-block'>\n        Dear" . $name . ",<br>\n        You have successfully registered for Technothlon 2015 with the following details: <br><br>\n        <div id='school'>\n            <div style='display: inline-block'>\n                <div>\n                    School Name:\n                </div>\n                <div>\n                    School Address:\n                </div>\n                <div>\n                    City:\n                </div>\n                <div>\n                    State\n                </div>\n            </div>\n            <div style='display: inline-block; margin-left: 10px'>\n                <div>\n                    " . $school->name . "\n                </div>\n                <div>\n                    " . $school->address . "\n                </div>\n                <div>\n                    " . $city->name . "\n                </div>\n                <div>\n                    " . $state->name . "\n                </div>\n            </div>\n        </div>\n        <div><br>\n            <div style='display: inline-block'>\n                Squad: {{ {$user->squad} }}\n            </div>\n            <div style='display: inline-block; margin-left: 20px'>\n                Medium: {{ {$user->language} }}\n            </div>\n        </div><br>\n        <div id='details'>\n            <div style='display: inline-block'>\n                <div style='display: inline-block'>\n                    <div>\n                        Name:\n                    </div>\n                    <div>\n                        Email:\n                    </div>\n                    <div>\n                        Contact:\n                    </div>\n                </div>\n                <div style='display: inline-block; margin-left: 10px'>\n                    <div>\n                        " . $user->name1 . "\n                    </div>\n                    <div>\n                        " . $user->email1 . "\n                    </div>\n                    <div>\n                        +91" . $user->contact1 . "\n                    </div>\n                </div>\n            </div>\n            <div style='display: inline-block; margin-left: 20px'>\n                <div style='display: inline-block'>\n                    <div>\n                        Name:\n                    </div>\n                    <div>\n                        Email:\n                    </div>\n                    <div>\n                        Contact:\n                    </div>\n                </div>\n                <div style='display: inline-block; margin-left: 10px'>\n                    <div>\n                        " . $user->name2 . "\n                    </div>\n                    <div>\n                        " . $user->email2 . "\n                    </div>\n                    <div>\n                        +91" . $user->contact2 . "\n                    </div>\n                </div>\n            </div>\n        </div>\n    </div><br><br><br><br>\n    <div id='roll'>\n        Given below is your roll number and password which will be required for accessing technopedia<br> and other features of Technothlon.<br><br>\n        <div style='display: inline-block;'>\n            <div>Roll Number:</div>\n            <div>Password:</div>\n        </div>\n        <div style='display: inline-block;'>\n            <div>" . $user->roll . "</div>\n            <div>" . $password . "</div>\n        </div><br><br>\n        <div id='details'>\n            <ul>\n                <li>The exam is on 19th July, 2015.</li>\n                <li>Technopedia starts from the 15th of every month and ends on the 10th of next month.</li>\n                <li>The first Technopedia starts from January</li>\n                <li>In case of any discrepancy, <a href='http://technothlon.techniche.org/contact' target='_blank'>Contact Us</a>. </li>\n            </ul>\n        </div>\n    </div>\n</div>\n</body>\n</html>\n        ";
     // Always set content-type when sending HTML email
     $headers = "MIME-Version: 1.0" . "\r\n";
     $headers .= "Content-type:text/html;charset=UTF-8" . "\r\n";
     // More headers
     $headers .= 'From: Technothlon<*****@*****.**>' . "\r\n";
     mail($to, $subject, $message, $headers);
 }