本文整理汇总了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');