public function getCountiesByGivenCountry($country_id) { $countryObj = new Country(); $country = $countryObj->findById($country_id); $data = $country->topTerritories; $ret = array(); foreach ($data as $territory) { $ret[$territory->county] = $territory->name; } return $ret; }
<?php $cid = isset($vars[1]) ? strip_tags($vars[1]) : null; $country = Country::findById($cid); $html = new HTML(); $html->renderOut('site/components/html_header', array('title' => 'Study in ' . $country->getName(), 'body_class' => 'single single-ib_educator_course has-toolbar')); $html->output('<div id="page-container">'); //$html->renderOut('site/components/toptoolbar'); $html->renderOut('site/components/header'); $html->renderOut('site/components/banner', array('country' => $country)); $html->renderOut('site/country', array('breadcrumb' => $html->render('site/components/breadcrumb', array('items' => array('Home' => uri(''), $country->getName() => false))), 'country' => $country, 'institutions' => Institution::findAllByCountryId($country->getId()), 'courses' => Course::findAllByCountryId($country->getId()), 'sidebar_right' => $html->render('site/components/sidebar_right', array('blocks' => array($html->render('site/components/sidebar_block_countries'), $html->render('site/components/sidebar_block_recent_news'), $html->render('site/components/sidebar_block_apply')))))); $html->renderOut('site/components/countries_block', array('title' => 'Other countries to apply for', 'countries' => Country::findAllExcluding($country->getId()))); $html->renderOut('site/components/footer'); $html->output('</div>'); $html->renderOut('site/components/page_footer'); $html->renderOut('site/components/html_footer');
public function getCountry() { return Country::findById($this->getCountryId()); }
/** * Remove the specified resource from storage. * * @param int $id * @return Response */ public function destroy($id) { $this->tagRepository->findById($id)->delete(); return Redirect::action('AdminTagsController@index')->with('success', 'Tag Deleted'); }
<?php $id = isset($vars[1]) ? $vars[1] : null; $object = Country::findById($id); if (is_null($object)) { HTML::forward('core/404'); } // handle form submission if (isset($_POST['submit'])) { $error_flag = false; /// validation // validation for $name $name = isset($_POST["name"]) ? strip_tags($_POST["name"]) : null; if (empty($name)) { Message::register(new Message(Message::DANGER, i18n(array("en" => "name is required.", "zh" => "请填写name")))); $error_flag = true; } // validation for $image $image = isset($_POST["image"]) ? strip_tags(trim($_POST["image"])) : null; if (empty($image)) { Message::register(new Message(Message::DANGER, i18n(array("en" => "image is required.", "zh" => "请填写image")))); $error_flag = true; } // validation for $banner_image $banner_image = isset($_POST["banner_image"]) ? strip_tags(trim($_POST["banner_image"])) : null; if (empty($banner_image)) { Message::register(new Message(Message::DANGER, i18n(array("en" => "banner_image is required.", "zh" => "请填写banner_image")))); $error_flag = true; } // validation for $content $content = isset($_POST["content"]) ? $_POST["content"] : null;
/** * Remove the specified resource from storage. * * @param int $id * @return Response */ public function destroy($id) { $this->countryRepository->findById($id)->delete(); return Redirect::action('AdminCountriesController@index'); }
<th>name</th> <th>country</th> <th>Actions</th> </tr> </thead> <tbody> <?php foreach ($objects as $object) { ?> <tr> <td><?php echo $object->getName(); ?> </td> <td><?php $country = Country::findById($object->getCountryId()); echo $country ? $country->getName() : 'N/A'; ?> </td> <td> <div class="btn-group"> <a class="btn btn-default btn-sm" href="<?php echo uri('admin/menu/order/' . $object->getId()); ?> "><i class="fa fa-edit"></i></a> <?php if ($object->getReserved() != 1) { ?> <a onclick="return confirm('<?php echo i18n(array('en' => 'Are you sure to delete this record ?', 'zh' => '你确定删除这条记录吗 ?')); ?>