Exemple #1
0
<?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;
Exemple #2
0
<?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');