示例#1
0
 private function functionsView()
 {
     \Service::get('view')->addFunction('page', function ($where = array()) {
         return \Page::showContent($where);
     });
     \Service::get('view')->addFunction('slab', function ($where = array()) {
         return \Slab::showContent($where);
     });
     \Service::get('view')->addFunction('carousel', function ($where = array()) {
         return \Carousel::show($where);
     });
 }
示例#2
0
 /**
  * This is the default 'index' action that is invoked
  * when an action is not explicitly requested by users.
  */
 public function actionIndex()
 {
     $ca = Carousel::model()->findAll(array('condition' => 'activo = 1 ORDER BY orden ASC'));
     $programaDestacados = Programa::model()->findAllByAttributes(array('destacado' => 1));
     $carousel = array();
     foreach ($ca as $caro) {
         $carousel[] = array('div' => '<div style="background-image: url(' . "'" . Yii::app()->request->baseUrl . '/images/carousel/' . $caro->foto . "'" . ')"></div>', 'label' => $caro->titulo, 'caption' => $caro->descripcion);
     }
     /*foreach ($programaDestacados as $programaDestacado) {
           print_r('<pre>');
           print_r($programaDestacado->programaImagens[0]->imagen);
           print_r('</pre>');
           exit;
       }*/
     // renders the view file 'protected/views/site/index.php'
     // using the default layout 'protected/views/layouts/main.php'
     $this->render('index', array('carousel' => $carousel, 'programaDestacados' => $programaDestacados));
 }
示例#3
0
<div class="row carouselPane">
  <div class="col-xs-12 mainCarousel hidden-xs">
<?php 
$carousel = new Carousel();
$carousel->setID("newCarousel");
$carousel->addXnewimages($mySQL_r, 3);
print $carousel->create();
?>
  </div>
</div>
<div class="row pane">
<?php 
$module_res = $page->getResource('modules');
$module_res->getModuleFromNS('news');
if ($module_res->isInstalled()) {
    ?>
  <div class="col-md-4">
    <div class="row">
      <div class="col-xs-12">
        <h2>News <?php 
    if ($mySQL_r->query("SELECT * from `news_articles` WHERE `publish`=1")->num_rows > 2) {
        print '<a class="btn btn-small btn-info pull-right" href="/news">Read more &raquo;</a>';
    }
    ?>
</h2>
      </div>
    </div>
    <div class="row">
      <div class="col-xs-12">
<?php 
    //include_once("lib/modules/article.php");
示例#4
0
 /** @test **/
 public function it_fetches_the_carousel_images_associated_with_the_page()
 {
     $this->createComponent('pages');
     $this->createComponent('carousel', function ($component) {
         $component->string('image');
     });
     $this->insertOn('pages', ['title' => 'Landing Page']);
     $this->insertOn('carousel', ['image' => '/path/to/image1.jpg']);
     $this->insertOn('carousel', ['image' => '/path/to/image2.jpg']);
     $this->insertOn('carousel', ['image' => '/path/to/image3.jpg']);
     Page::first()->usesMany(Carousel::class);
     Carousel::get()->each(function ($carousel) {
         $carousel->registerTo(Page::first());
     });
     $carousel = Page::first()->carousel;
     $this->assertEquals('/path/to/image1.jpg', $carousel[0]->image);
     $this->assertEquals('/path/to/image2.jpg', $carousel[1]->image);
     $this->assertEquals('/path/to/image3.jpg', $carousel[2]->image);
 }
 public function setCarousel()
 {
     $carousel = new Carousel();
     $carousel->id = 5;
     $carousel->addTime = time();
     $carousel->path = "uploads/carousel/path/5.jpg";
     $carousel->url = "";
     $carousel->weight = 0;
     $carousel->courseId = 0;
     $carousel->save();
     $carousel = new Carousel();
     $carousel->id = 6;
     $carousel->addTime = time();
     $carousel->path = "uploads/carousel/path/6.jpg";
     $carousel->url = "";
     $carousel->weight = 1;
     $carousel->courseId = 0;
     $carousel->save();
 }
示例#6
0
             $location['image_url'] = $gallery[0]['full_size'];
             $location['thumbnail_image'] = '<img src="' . $gallery[0]['thumbnail_size'] . '">';
             $location['thumbnail_url'] = $gallery[0]['thumbnail_size'];
             $locations[] = $location;
         }
         /*else{
         
                                 }*/
         /*echo "<pre>";
           print_r($location);
           echo "</pre>";*/
     }
 }
 switch ($component) {
     case 'carousel':
         Carousel::display_carousel($locations);
         break;
     case 'grid':
         Grid::display_grid($locations);
         break;
     case 'card':
         Card::display_card_simple($locations);
         break;
     case 'button':
         Button::display_buttons($locations);
         break;
     case 'masonry':
         Masonry::display_masonry($locations);
         break;
     case 'flex-layout':
         Freewall::display_flex_layout($locations);
示例#7
0
    $carousel->setButtonLink(uri('about'));
    $carousel->save();
    $carousel = new Carousel();
    $carousel->setTitle('Free eveluation service');
    $carousel->setContent('If you are in doubt, we can provide consulation for FREE!');
    $carousel->setImage('files/fixture/carousel/slider1.jpg');
    $carousel->setButtonText('How?');
    $carousel->setButtonLink(uri('about'));
    $carousel->save();
    $carousel = new Carousel();
    $carousel->setTitle('Full refund guarantee');
    $carousel->setContent('In case you are not happy with the service provided, we offer full refund in 7 days!');
    $carousel->setImage('files/fixture/carousel/slider2.jpg');
    $carousel->setButtonText('Check details');
    $carousel->setButtonLink(uri('about'));
    $carousel->save();
    $carousel = new Carousel();
    $carousel->setTitle('Up to date news in your mail box');
    $carousel->setContent('Sign up with our news letter, we deliver latest immigration news straight to your mail box!');
    $carousel->setImage('files/fixture/carousel/slider3.jpg');
    $carousel->setButtonText('Check details');
    $carousel->setButtonLink(uri('about'));
    $carousel->save();
    $carousel = new Carousel();
    $carousel->setTitle('Happy clients');
    $carousel->setContent('We are pround to say that our service is rated 5 stars by 85% of our clients!');
    $carousel->setImage('files/fixture/carousel/slider4.jpg');
    $carousel->setButtonText('Check details');
    $carousel->setButtonLink(uri('about'));
    $carousel->save();
}
示例#8
0
<?php

$page = isset($_GET['page']) ? $_GET['page'] : 1;
if (!preg_match('/^\\d+$/', $page)) {
    dispatch('core/backend/404');
    exit;
}
$objects = Carousel::findAll();
$html = new HTML();
$html->renderOut('core/backend/html_header', array('title' => i18n(array('en' => 'Carousel', 'zh' => '首页横幅'))), true);
$html->output('<div id="wrapper">');
$html->renderOut('core/backend/header');
$perpage = 50;
$total = Carousel::countAll();
$total_page = ceil($total / $perpage);
$html->renderOut('carousel/backend/carousel_list', array('objects' => Carousel::findAllWithPage($page, $perpage), 'current_page' => $page, 'total_page' => $total_page, 'total' => $total, 'pager' => $html->render('core/components/pagination', array('total' => $total_page, 'page' => $page)), 'start_entry' => ($page - 1) * $perpage + 1, 'end_entry' => min(array($total, $page * $perpage))), true);
$html->output('</div>');
$html->renderOut('core/backend/html_footer');
exit;
示例#9
0
<?php

//-- Carousel:Clear cache
if ($command == "cc") {
    if ($arg1 == "all" || $arg1 == "carousel") {
        echo " - Drop table 'carousel' ";
        echo Carousel::dropTable() ? "success\n" : "fail\n";
    }
}
//-- Carousel:Import DB
if ($command == "import" && $arg1 == "db" && (is_null($arg2) || $arg2 == "carousel")) {
    //- create tables if not exits
    echo " - Create table 'carousel' ";
    echo Carousel::createTableIfNotExist() ? "success\n" : "fail\n";
}
示例#10
0
文件: main.php 项目: stan5621/eduwind
        </div>
    </div>


    <!-- Flash 通知信息 -->
    <?php 
$this->renderPartial('//layouts/_flash_messages');
?>

    <?php 
if (Yii::app()->controller->id == "site" && Yii::app()->controller->action->id == "index") {
    ?>
        <!-- 轮播图 -->
        <div class="hidden-xs main-carousel">
            <?php 
    $carousels = Carousel::model()->findAll(array('order' => 'weight asc'));
    $carourseItems = array();
    foreach ($carousels as $carousel) {
        $item = array();
        $item['image'] = Yii::app()->baseUrl . "/" . $carousel->path;
        $item['imageOptions'] = array('style' => "width:100%;");
        if ($carousel->url) {
            $item['url'] = $carousel->url;
        }
        if ($carousel->course) {
            $item['label'] = CHtml::link($carousel->course->name, $carousel->course->pageUrl);
            $item['url'] = $carousel->course->pageUrl;
        }
        $carourseItems[] = $item;
    }
    if (count($carourseItems) > 0) {
示例#11
0
 public function carousel()
 {
     return View::make('admin.carousel')->withCarousel(Carousel::paginate(15));
 }
 function carouselMoveUp()
 {
     $pid = isset($_GET['pid']) ? addslashes($_GET['pid']) : 0;
     $car = new Carousel();
     $car->getByID($pid);
     $car->photo_zIndex = $car->getMaxZIndex() + 1;
     $car->load = 1;
     $car->save();
 }
示例#13
0
    protected function is_active()
    {
        $items = get_option(self::OPTION);
        if ($items && is_front_page()) {
            return true;
        }
        return false;
    }
    /**
     * Sets up admin page.
     * @return void
     */
    public function settings()
    {
        $fm = new \Fieldmanager_Group(array('name' => self::OPTION, 'limit' => 10, 'add_more_label' => __('Add another item', 'mindseyesociety'), 'sortable' => true, 'label' => __('Carousel Item', 'mindseyesociety'), 'children' => array('image' => new \Fieldmanager_Media(array('label' => __('Image', 'mindseyesociety'), 'preview_size' => 'thumbnail')), 'link' => new \Fieldmanager_Link(array('label' => __('URL', 'mindseyesociety'), 'inline_label' => true)), 'external' => new \Fieldmanager_Checkbox(array('label' => __('Open in new window', 'mindseyesociety'), 'inline_label' => true)))));
        $fm->activate_submenu_page();
    }
    /**
     * Singleton method.
     * @return Carousel Self.
     */
    public static function instance()
    {
        if (!self::$instance) {
            self::$instance = new self();
        }
        return self::$instance;
    }
}
Carousel::instance();
示例#14
0
文件: index.php 项目: jeffreycai/ct21
<?php

// get youtube video url from block
$block = Block::findByName('Youtube video');
$matches = array();
preg_match('/www.youtube.com\\/embed\\/([^\\<&]+)/', $block, $matches);
if (isset($matches[1])) {
    $youtube_id = $matches[1];
} else {
    preg_match('/www.youtube.com\\/watch\\?v=([^\\<&]+)/', $block, $matches);
    $youtube_id = $matches[1];
}
$youtube_url = isset($youtube_id) ? "https://www.youtube.com/embed/{$youtube_id}" : 'https://www.youtube.com/embed/jiBxpdobg0E';
$html = new HTML();
$html->renderOut('site/components/html_header', array('title' => $settings['sitename'], 'body_class' => 'home page page-id-115 page-template-default has-toolbar'));
$html->output('<div id="page-container">');
//$html->renderOut('site/components/toptoolbar');
$html->renderOut('site/components/header');
$html->renderOut('site/components/slider', array('carousels' => Carousel::findAll()));
$html->renderOut('site/components/latest_news', array('youtube_url' => $youtube_url));
$html->renderOut('site/components/countries_block', array('title' => 'Apply for oversea study', 'countries' => Country::findAll()));
$html->renderOut('site/components/testimonial');
$html->renderOut('site/components/footer');
$html->output('</div>');
$html->renderOut('site/components/page_footer');
$html->renderOut('site/components/html_footer');
示例#15
0
<?php

$id = isset($vars[1]) ? $vars[1] : null;
$object = Carousel::findById($id);
$error_flag = false;
if ($object) {
    if ($object->delete()) {
        Message::register(new Message(Message::SUCCESS, i18n(array('en' => 'Record deleted', 'zh' => '记录删除成功'))));
    } else {
        $error_flag = true;
    }
} else {
    $error_flag = true;
}
if ($error_flag) {
    Message::register(new Message(Message::DANGER, i18n(array('en' => 'Record deletion failed', 'zh' => '记录删除失败'))));
}
HTML::forwardBackToReferer();
示例#16
0
         $images = get_post_meta($post->ID, 'gallery');
     }
     $country['title'] = get_the_title($post->ID);
     //echo $country['title'];
     $country['subtitle'] = '';
     $country['post_link'] = $post_url;
     $country['image_url'] = wp_get_attachment_url($images[0]);
     $country['thumbnail_image'] = wp_get_attachment_image($images[0], 'thumbnail');
     $country['thumbnail_url'] = wp_get_attachment_thumb_url($images[0]);
     $countries[] = $country;
 }
 $component = $design_options['display_promotion_component'];
 //echo $component;
 switch ($component) {
     case 'carousel':
         Carousel::display_carousel($countries);
         break;
     case 'grid':
         Grid::display_grid($countries);
         break;
     case 'card':
         echo 'Display cards';
         break;
     case 'button':
         echo 'Display buttons';
         break;
     case 'masonry':
         Masonry::display_masonry($countries);
         break;
     case 'flex-layout':
         Freewall::display_flex_layout($countries);
示例#17
0
<?php

$object = new Carousel();
// 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 $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;
    if (empty($content)) {
        Message::register(new Message(Message::DANGER, i18n(array("en" => "content is required.", "zh" => "请填写content"))));
        $error_flag = true;
    }
    // validation for $button_text
    $button_text = isset($_POST["button_text"]) ? strip_tags($_POST["button_text"]) : null;
    if (empty($button_text)) {
        Message::register(new Message(Message::DANGER, i18n(array("en" => "button_text is required.", "zh" => "请填写button_text"))));
        $error_flag = true;
    }
 /**
  * Returns the data model based on the primary key given in the GET variable.
  * If the data model is not found, an HTTP exception will be raised.
  * @param integer $id the ID of the model to be loaded
  * @return Carousel the loaded model
  * @throws CHttpException
  */
 public function loadModel($id)
 {
     $model = Carousel::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }
示例#19
0
     $terms = get_the_terms($post->ID, 'theme');
     $term = $terms[0];
     $theme['title'] = $term->name;
     $theme['subtitle'] = '';
     $theme['post_link'] = $post_url;
     $theme['image_url'] = wp_get_attachment_url($post->ID);
     $theme['thumbnail_image'] = wp_get_attachment_image($post->ID, 'thumbnail');
     $theme['thumbnail_url'] = wp_get_attachment_thumb_url($post->ID);
     $themes[] = $theme;
 }
 /*echo "<pre>";
   print_r($themes);
   echo "</pre>";*/
 switch ($component) {
     case 'carousel':
         Carousel::display_carousel($themes);
         break;
     case 'grid':
         Grid::display_grid($themes);
         break;
     case 'card':
         Card::display_card_simple($themes);
         break;
     case 'button':
         Button::display_buttons($themes);
         break;
     case 'masonry':
         Masonry::display_masonry($themes);
         break;
     case 'flex-layout':
         Freewall::display_flex_layout($themes);
示例#20
0
 public static function get_component($component, $data)
 {
     $display = "";
     switch ($component) {
         case 'carousel':
             $display .= Carousel::display_carousel($data, true);
             break;
         case 'grid':
             $display .= Grid::display_grid($data, true);
             break;
         case 'card':
             $display .= Card::display_card_simple($data, true);
             break;
         case 'button':
             $display .= Button::display_buttons($data, true);
             break;
         case 'masonry':
             $display .= Masonry::display_masonry($data, true);
             break;
         case 'flex-layout':
             $display .= Freewall::display_flex_layout($data, true);
             break;
         case 'windows':
             $display .= Freewall::display_win8_layout($data, true);
             break;
         case 'img-layout':
             $display .= Freewall::display_image_layout($data, true);
             break;
         case 'pinterest':
             $display .= Freewall::display_pinterest_layout($data, true);
             break;
         default:
             $display .= Grid::display_grid($data, true);
             break;
     }
     return $display;
 }
示例#21
0
 /**
  * Render the carousel template
  *
  */
 public static function do_shortcode()
 {
     return Carousel::render();
 }