Пример #1
0
 /**
  * Creates a new model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  */
 public function actionCreate()
 {
     $model = new Carousel();
     // Uncomment the following line if AJAX validation is needed
     // $this->performAjaxValidation($model);
     if (isset($_POST['Carousel'])) {
         $model->attributes = $_POST['Carousel'];
         if ($model->save()) {
             $this->redirect(array('index'));
         }
     }
     $this->render('create', array('model' => $model));
 }
Пример #2
0
 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();
 }
Пример #3
0
    $weight = isset($_POST["weight"]) ? strip_tags($_POST["weight"]) : null;
    /// proceed submission
    // proceed for $title
    $object->setTitle($title);
    // proceed for $image
    $object->setImage($image);
    // proceed for $content
    $object->setContent($content);
    // proceed for $button_text
    $object->setButtonText($button_text);
    // proceed for $button_link
    $object->setButtonLink($button_link);
    // proceed for $weight
    $object->setWeight($weight);
    if ($error_flag == false) {
        if ($object->save()) {
            Message::register(new Message(Message::SUCCESS, i18n(array("en" => "Record saved", "zh" => "记录保存成功"))));
            HTML::forwardBackToReferer();
        } else {
            Message::register(new Message(Message::DANGER, i18n(array("en" => "Record failed to save", "zh" => "记录保存失败"))));
        }
    }
}
$html = new HTML();
$html->renderOut('core/backend/html_header', array('title' => i18n(array('en' => 'Create Carousel', 'zh' => 'Create 首页横幅'))));
$html->output('<div id="wrapper">');
$html->renderOut('core/backend/header');
$html->renderOut('carousel/backend/carousel_create', array('object' => $object));
$html->output('</div>');
$html->renderOut('core/backend/html_footer');
exit;
Пример #4
0
 public function addCarousel()
 {
     $validator = Validator::make(Input::all(), array('image' => 'required|image'));
     if ($validator->fails()) {
         return Redirect::back()->withErrors($validator->messages());
     }
     $image = Input::file('image');
     $name = Input::file('image')->getClientOriginalName();
     $menu = new Carousel();
     $menu->title = '';
     $menu->img = $name;
     $menu->save();
     if (file_exists(public_path('carousel/' . $name))) {
         return Redirect::back();
     }
     Input::file('image')->move(public_path('carousel/'), $name);
     return Redirect::back();
 }
 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();
 }
Пример #6
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();
}