本文整理匯總了PHP中Institution::findById方法的典型用法代碼示例。如果您正苦於以下問題:PHP Institution::findById方法的具體用法?PHP Institution::findById怎麽用?PHP Institution::findById使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Institution
的用法示例。
在下文中一共展示了Institution::findById方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: isset
<?php
$id = isset($vars[1]) ? $vars[1] : null;
$object = Institution::findById($id);
if (is_null($object)) {
HTML::forward('core/404');
}
// handle form submission
if (isset($_POST['submit'])) {
$error_flag = false;
/// validation
// validation for $title
$title = isset($_POST["title"]) ? strip_tags($_POST["title"]) : null;
if (empty($title)) {
Message::register(new Message(Message::DANGER, i18n(array("en" => "title is required.", "zh" => "請填寫title"))));
$error_flag = true;
}
// validation for $country_id
$country_id = isset($_POST["country_id"]) ? strip_tags($_POST["country_id"]) : null;
if (empty($country_id)) {
Message::register(new Message(Message::DANGER, i18n(array("en" => "country_id is required.", "zh" => "請填寫country_id"))));
$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 $content
$content = isset($_POST["content"]) ? $_POST["content"] : null;
示例2: isset
<?php
$id = isset($vars[1]) ? $vars[1] : null;
$institution = Institution::findById($id);
$country = $institution->getCountry();
if (is_null($institution)) {
dispatch('site/404');
exit;
}
$html = new HTML();
$html->renderOut('site/components/html_header', array('title' => 'Institution - ' . $institution->getTitle(), '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/institution', array('breadcrumb' => $html->render('site/components/breadcrumb', array('items' => array('Home' => uri(''), $country->getName() => uri('country/' . $country->getId()), $institution->getTitle() => false))), 'institution' => $institution, 'sidebar_right' => $html->render('site/components/sidebar_right', array('blocks' => array($html->render('site/components/sidebar_block_institutions', array('institution' => $institution)), $html->render('site/components/sidebar_block_recent_news'), $html->render('site/components/sidebar_block_apply'))))));
$html->renderOut('site/components/footer');
$html->output('</div>');
$html->renderOut('site/components/page_footer');
$html->renderOut('site/components/html_footer');