Пример #1
0
 public function addSlide(Slide $s)
 {
     if ($s->getId() != '' && $this->getId() != '') {
         $con = BDConexao::__Abrir();
         $con->executar("INSERT INTO " . Sistema::$BDPrefixo . "relacionamento_slides_categorias(categoria, slide) VALUES('" . $this->getId() . "','" . $s->getId() . "')");
     }
 }
Пример #2
0
 function destroy()
 {
     $o = new Slide();
     $this->slide = $o->find($_REQUEST["id"]);
     $this->slide->destroy();
     $this->index();
     $this->render_view = "index";
 }
Пример #3
0
 public function run()
 {
     $criteria = new CDbCriteria();
     $criteria->select = '*';
     $criteria->condition = '`visible` = 1';
     $criteria->order = "id desc";
     $this->render("slider", array("slides" => Slide::model()->findAll($criteria)));
 }
 /**
  * This is the default 'index' action that is invoked
  * when an action is not explicitly requested by users.
  */
 public function actionIndex()
 {
     // renders the view file 'protected/views/site/studentIndex.php'
     // using the default layout 'protected/views/layouts/main.php'
     $articleData = Article::model()->getBriefArticlesData(self::homePageArticleLimit);
     $slideItems = Slide::getSliderItems();
     Yii::log(CVarDumper::dumpAsString($slideItems));
     $this->render('index', array('articleData' => $articleData, 'slideItems' => $slideItems));
 }
 public function home()
 {
     //appel des composants en base
     $headings = Heading::all();
     $slides = Slide::all();
     $featurets = Featuret::all();
     //retour de la vue
     return View::make('home', array('headings' => $headings, 'slides' => $slides, 'featurets' => $featurets));
 }
 public function deleteDeletarSlide($id)
 {
     $slide = Slide::find($id);
     $slideNome = Input::get('foto');
     if (!File::delete($slideNome)) {
         return Redirect::to('admin/slide')->with('message', 'Erro ao deletar o slide.');
     } else {
         $slide->delete();
         return Redirect::to('admin/slide')->with('message', 'Slide deletada com sucesso.');
     }
 }
 public function editar()
 {
     //Aca se manda a la funcion agregarItem de la clase Item
     //y se queda con la respuesta para redirigir cual sea el caso
     $respuesta = Slide::editarSlideHome(Input::all());
     if ($respuesta['error'] == true) {
         return Redirect::to('admin/slide/editar/' . Input::get('slide_id') . '/' . Input::get('continue'))->with('mensaje', $respuesta['mensaje'])->with('error', true);
     } else {
         $anclaProd = '#Pr' . $respuesta['data']->id . $respuesta['data']->tipo;
         return Redirect::to('/')->with('mensaje', $respuesta['mensaje'])->with('ok', true)->with('anclaProd', $anclaProd);
     }
 }
Пример #8
0
 public function listar($ordem = "ASC", $campo = self::ID)
 {
     $info = parent::listar($ordem, $campo);
     if (!empty($info)) {
         $temp = new Slide($info[self::ID]);
         parent::resgatarObjetos($info);
         $temp->titulo = $info[self::TITULO];
         $temp->legenda = $info[self::LEGENDA];
         $temp->enderecoURL = $info[self::ENDERECOURL];
         $temp->ativo = $info[self::ATIVO] == self::VALOR_ATIVO_TRUE ? true : false;
         $temp->tipo = $info[self::TIPO];
         $temp->segundos = $info[self::SEGUNDOS];
         $temp->corfundo = $info[self::CORFUNDO];
         $temp->ordem = $info[self::ORDEM];
         if (!empty($info[self::IMAGEM])) {
             $temp->setImagem(new Image(new Arquivos(Sistema::$caminhoURL . Sistema::$caminhoDataSlides . $info[self::IMAGEM])));
         }
         $temp->setFlash($info[self::FLASH]);
         return $temp;
     }
 }
 /**
  * This is the default 'index' action that is invoked
  * when an action is not explicitly requested by users.
  */
 public function actionIndex()
 {
     date_default_timezone_set('America/Bogota');
     $slides = Slide::model()->findAllByAttributes(array('status_slide' => 1), array('order' => 't.id_slide DESC'));
     $lastNews = News::model()->findAllByAttributes(array('status_new' => 1), array('order' => 't.id_new DESC', 'limit' => 2));
     $dateNow = new DateTime("now");
     $date = Dates::model()->findByAttributes(array('date_date' => $dateNow->format('Y-m-d'), 'status_date' => 1));
     if ($date != null) {
         $events = Events::model()->findAllByAttributes(array('dates_id_date' => $date->id_date, 'status_event' => 1), array('order' => 't.hour_event ASC'));
     } else {
         $events = null;
     }
     $this->render('index', array('date_now' => $dateNow, 'events' => $events, 'lastNews' => $lastNews, 'slides' => $slides));
 }
Пример #10
0
 function __construct()
 {
     $this->initConnection();
     $decks = $this->dbquery('SELECT * FROM deck WHERE language IS NULL OR language="" OR language="-"');
     echo 'decks:' . count($decks);
     foreach ($decks as $task) {
         $deck = new Deck();
         $deck->deck_id = $task['id'];
         $deck->createFromID($deck->getLastRevisionID());
         $language = $deck->detectLanguage();
         $deck->setLanguageFull($language);
     }
     $slides = $this->dbquery('SELECT * FROM slide WHERE language IS NULL OR language="" OR language="-"');
     echo 'slides:' . count($slides);
     $decks = array();
     foreach ($slides as $task) {
         $slide = new Slide();
         $slide->slide_id = $task['id'];
         $id = $slide->getLastRevisionID();
         $decks_array = $this->dbGetOne('SELECT deck_revision_id FROM deck_content WHERE item_id =:id AND item_type="slide" LIMIT 1', array('id' => $id));
         if ($decks_array) {
             if (!in_array($decks_array, $decks)) {
                 $decks[] = $decks_array;
             }
         }
     }
     echo 'decks:' . count($decks) . '<br>';
     foreach ($decks as $task) {
         echo $task;
         $deck = new Deck();
         $deck->createFromID($task);
         $language = $deck->detectLanguage();
         $deck->setLanguageFull($language);
         echo ' done ';
     }
 }
Пример #11
0
 public function init($id)
 {
     $slide = Slide::find($id);
     /*'1' => 'SuperSlide','2' => '静态图片','3' => '纯Javascript'*/
     switch ($slide->type) {
         case 1:
             $banners = $slide->banners;
             $view = 'superSlide';
             break;
         case 2:
             $banners = $slide->banners->first();
             $view = 'img';
             break;
         default:
             $banners = $slide->banners->first();
             $view = 'img';
             break;
     }
     return View::make('ad.' . $view, compact('banners'))->render();
 }
Пример #12
0
<?php

/**@var Slide $model */
$this->breadcrumbs = array('Slides' => array('index'), Formatter::formatOrdinal($model->position + 1));
$this->menu = array(array('label' => 'List Slides', 'url' => array('index')), array('label' => 'Create Slide', 'url' => array('create')), array('label' => 'Update Slide', 'url' => array('update', 'id' => $model->slide_id)), array('label' => 'Delete Slide', 'url' => '#', 'linkOptions' => array('submit' => array('delete', 'id' => $model->slide_id), 'confirm' => 'Are you sure you want to delete this item?')), array('label' => 'Manage Slides', 'url' => array('admin')));
?>

<h1><?php 
echo Formatter::formatOrdinal($model->position + 1) . " Slide";
?>
</h1>

<div class="row-fluid" id="area_slide">
    <?php 
$this->widget('bootstrap.widgets.TbCarousel', array('items' => array(array('image' => Slide::generateImagePath($model->slide_image, $model->getPrimaryKey()), 'label' => $model->label, 'caption' => $model->caption)), 'htmlOptions' => array('id' => 'viewSlider'), 'options' => array('interval' => false)));
?>
</div>




Пример #13
0
 function edit()
 {
     if (isset($_POST['save'])) {
         $id = $this->input->post('id');
         $title = trim($this->input->post('title'));
         $alias = trim($this->input->post('alias'));
         if ($alias) {
             $alias = preg_replace('/\\s+/', '-', strtolower($alias));
             $alias = preg_replace('/&/', '-', $alias);
             $alias = preg_replace('#/+#', '-', $alias);
             $alias = preg_replace('/---/', '-', $alias);
             $alias = preg_replace('/\'/', '', $alias);
         } else {
             $alias = preg_replace('/\\s+/', '-', strtolower($title));
             $alias = preg_replace('/&/', '-', $alias);
             $alias = preg_replace('#/+#', '-', $alias);
             $alias = preg_replace('/---/', '-', $alias);
             $alias = preg_replace('/\'/', '', $alias);
         }
         $data = array('title' => $title, 'alias' => strtolower($alias), 'state' => $this->input->post('state'), 'order' => trim($this->input->post('order')), 'width' => trim($this->input->post('width')), 'height' => trim($this->input->post('height')), 'alt_text' => trim($this->input->post('alt_text')), 'link' => trim($this->input->post('link')), 'image' => trim($this->input->post('image')), 'scat_id' => trim($this->input->post('scat_id')), 'created_date' => date('y:m:d h:m:s'), 'intro_desc' => trim($this->input->post('intro_desc')));
         $dataIn = $this->crud_model->updateData('slide', 'id', $id, $data);
         if ($dataIn) {
             $this->admintemp->write('message', 'Edited Successfully');
             redirect('slide');
         } else {
             $this->admintemp->write('message', 'Error occured while editing');
             Slide::index();
         }
     } else {
         Slide::_edit();
     }
 }
Пример #14
0
 public function getdelete($id)
 {
     $profile = Slide::find($id);
     $profile->delete();
     return Redirect::to('dashboard/admin/latestnews');
 }
Пример #15
0
 public function saveToDB($user_id)
 {
     // create a deck with the name of a presentation
     $content = array();
     $new_deck = new Deck();
     $user = new User();
     $user->createFromID($user_id);
     $new_deck->user = $user;
     $new_deck->comment = "new deck created!";
     $new_deck->title = $this->_title;
     $deck_rev_id = $new_deck->create();
     // get each slide and put it in the deck
     for ($i = 0; $i < $this->_numberof_slides; $i++) {
         $new_slide = new Slide();
         $new_slide->user = $user;
         $new_slide->comment = "new slide created!";
         $slide_content = $this->_slides[$i]->_html_slide;
         $new_slide->content = $slide_content;
         $new_slide->deck = $new_deck->id;
         $new_slide->position = $i + 1;
         $slide_rev_id = $new_slide->create();
         $content[] = $new_slide;
         // populate media_relations table
         if (sizeof($this->_slides[$i]->_pics) != 0) {
             foreach ($this->_slides[$i]->_pics as $pic) {
                 $img = new Media();
                 $img->addRelationsFor($pic->_db_id, $deck_rev_id, $slide_rev_id);
             }
         }
     }
     $new_deck->addContent($content);
     return $new_deck->id;
 }
Пример #16
0
 public static function editarSlideHome($input)
 {
     $respuesta = array();
     //Se definen las reglas con las que se van a validar los datos..
     $reglas = array('slide_id' => array('required'));
     //Se realiza la validación
     $validator = Validator::make($input, $reglas);
     if ($validator->fails()) {
         //Si está todo mal, carga lo que corresponde en el mensaje.
         $respuesta['mensaje'] = $validator;
         $respuesta['error'] = true;
     } else {
         //Se cargan los datos necesarios para la creacion del Item
         $slide = Slide::find($input['slide_id']);
         $slide->fecha_modificacion = date("Y-m-d H:i:s");
         $slide->save();
         //Lo crea definitivamente
         if (isset($input['imagenes_slide']) && $input['imagenes_slide'] != "") {
             if (is_array($input['imagenes_slide'])) {
                 foreach ($input['imagenes_slide'] as $key => $imagen) {
                     if ($imagen != "") {
                         $imagen_creada = Imagen::agregarImagenAngularSlideHome($imagen, $input['epigrafe_slide'][$key]);
                         if (!$imagen_creada['error']) {
                             $info = array('estado' => 'A', 'fecha_carga' => date("Y-m-d H:i:s"), 'usuario_id_carga' => Auth::user()->id);
                             $slide->imagenes()->attach($imagen_creada['data']->id, $info);
                         }
                     }
                 }
             }
         }
         if (isset($input['imagen_slide_editar']) && $input['imagen_slide_editar'] != "") {
             if (is_array($input['imagen_slide_editar'])) {
                 foreach ($input['imagen_slide_editar'] as $key => $imagen) {
                     if ($imagen != "") {
                         $info = array('id' => $imagen, 'epigrafe' => $input['epigrafe_imagen_slide_editar'][$key]);
                         $imagen_creada = Imagen::editar($info);
                     }
                 }
             }
         }
         //Mensaje correspondiente a la agregacion exitosa
         $respuesta['mensaje'] = 'Slide modificado.';
         $respuesta['error'] = false;
         $respuesta['data'] = $slide;
     }
     return $respuesta;
 }
 public function relations()
 {
     return array_merge(parent::relations(), array('entity' => array(self::BELONGS_TO, self::TYPE_OF_SLIDE, 'entity_id')));
 }
Пример #18
0
 /**
  * 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 Slide the loaded model
  * @throws CHttpException
  */
 public function loadModel($id)
 {
     $model = Slide::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }
 /**
  * testAdminSlideEdit
  *
  */
 public function testAdminSlideEdit()
 {
     $this->goIntoLoginStatus('Managements');
     $this->testAction('/admin/managements/slide_edit/4', array('method' => 'GET', 'return' => 'contents'));
     $this->assertContains(__('Edit Slide'), $this->view);
     $this->assertContains('TestSlide4', $this->view);
     $this->assertContains('The Description of TestSlide4', $this->view);
     $data = array('Slide' => array('id' => 4, 'name' => 'Updated4', 'description' => 'UpdatedDescription4', 'downloadable' => 1, 'category_id' => 3, 'key' => '1cf9ff7657312d63072439632e6110bd', 'convert_status' => 100, 'tags' => 'sushi'));
     //@TODO:This configure setting must be removed after cakedc/tags fixes the issue
     Configure::write('debug', 0);
     $this->testAction('/admin/managements/slide_edit/4', array('data' => $data, 'method' => 'POST', 'return' => 'contents'));
     Configure::write('debug', 2);
     $this->assertContains('/admin/managements/slide_list', $this->headers['Location']);
     App::uses('Slide', 'Model');
     $s = new Slide();
     $s->useDbConfig = 'test';
     $s->recursive = -1;
     $s->id = 1;
     $rec = $s->read(null, 4);
     $this->assertEqual($rec['Slide']['name'], $data['Slide']['name']);
     $this->assertEqual($rec['Slide']['description'], $data['Slide']['description']);
     $this->assertEqual($rec['Slide']['downloadable'], $data['Slide']['downloadable']);
     $this->assertEqual($rec['Slide']['category_id'], $data['Slide']['category_id']);
     $this->assertEqual($rec['Slide']['user_id'], 2);
 }
Пример #20
0
 public function getCourse(Slide $slide)
 {
     $result = $this->_access->getRow($this->_access->prepare("SELECT * FROM " . StudyPressDB::getTableNameLesson() . " WHERE " . StudyPressDB::COL_ID_ACTIVITY . " = '%d'", $slide->courseId()));
     return LessonManager::returnedLesson($result);
 }
Пример #21
0
 public function actionHomenew()
 {
     $Criteria = new CDbCriteria();
     $Criteria->condition = "status = 1";
     $Criteria->order = "sort_order";
     $Criteria->offset = 0;
     $Criteria->limit = 4;
     $model = Slide::model()->findAll($Criteria);
     $condition = new CDbCriteria();
     $condition->condition = "news_type_id =2 AND status = 1";
     $condition->order = "create_date desc,news_id desc";
     $condition->offset = 0;
     $condition->limit = 4;
     $student_news = News::model()->findAll($condition);
     $news_criteria = new CDbCriteria();
     $news_criteria->condition = "news_type_id <>2 AND news_type_id <>3 AND status = 1";
     $news_criteria->order = "create_date desc,news_id desc";
     $news_criteria->offset = 0;
     $news_criteria->limit = 8;
     $news = News::model()->findAll($news_criteria);
     $job_criteria = new CDbCriteria();
     $job_criteria->condition = "news_type_id =3 AND status = 1";
     $job_criteria->order = "create_date desc,news_id desc";
     $job_criteria->offset = 0;
     $job_criteria->limit = 4;
     $job = News::model()->findAll($job_criteria);
     $event_criteria = new CDbCriteria();
     $event_criteria->condition = "event_start >= " . date('Y-m-d') . " AND event_status = 1";
     $event_criteria->order = "event_start ,event_id";
     $event_criteria->offset = 0;
     $event_criteria->limit = 5;
     $events = Event::model()->findAll($event_criteria);
     //                $pr_criteria = new CDbCriteria();
     //                $pr_criteria->condition = "news_type_id =5 AND status = 1";
     //                $pr_criteria->order = "create_date desc,news_id desc";
     //                $pr_criteria->offset = 0;
     //                $pr_criteria->limit = 4;
     //                $newsInSide = News::model()->findAll($pr_criteria);
     $link_criteria = new CDbCriteria();
     $link_criteria->condition = "status = 1";
     $link_criteria->order = "sort_order";
     $links = Link::model()->findAll($link_criteria);
     $vdo_criteria = new CDbCriteria();
     $vdo_criteria->condition = "page_id = 3 AND status = 1";
     $vdo = Page::model()->find($vdo_criteria);
     //                 echo "<br> ===> ";
     //                 echo "<pre>";
     //                 print_r($vdo);
     //                 echo "</pre>";
     //                 exit;
     $this->render('index_new', array('model' => $model, 'news' => $news, 'job' => $job, 'student_news' => $student_news, 'links' => $links, 'vdo' => $vdo, 'events' => $events));
 }
Пример #22
0
<?php

importar("Utilidades.Publicidades.Slides.Lista.ListaSlideCategorias");
$tituloPagina = 'Utilidades > Publicidades > Slides > Cadastrar';
$iTCS = new IFAdmin(new Arquivos(Sistema::$adminLayoutCaminhoDiretorio . "/SistemaUtilidades/slide.html"));
$lI = new ListaIdiomas();
if (!empty($_POST)) {
    $erro = '';
    if (empty($_POST['titulo'])) {
        $erro = "<b>Titulo</b> não preenchido!<br><br>";
    }
    if (empty($erro)) {
        try {
            $s = new Slide();
            $s->titulo = $_POST['titulo'];
            $s->enderecoURL = $_POST['enderecoURL'];
            $s->tipo = $_POST['tipo'];
            $s->legenda = $_POST['legenda'];
            $s->segundos = $_POST['segundos'];
            $s->corfundo = $_POST['corfundo'];
            $s->ordem = $_POST['ordem'];
            $s->ativo = $_POST['ativo'] == ListaSlides::VALOR_ATIVO_TRUE ? true : false;
            if (!empty($_FILES['flash']['name'])) {
                $arq = Arquivos::__OpenArquivoByTEMP($_FILES['flash']);
                $arq->saveArquivo(Sistema::$caminhoDiretorio . Sistema::$caminhoDataSlides);
                $s->setFlash($_FILES['flash']['name']);
            }
            if (!empty($_FILES['imagem']['name'])) {
                $s->setImagem(new Image(Arquivos::__OpenArquivoByTEMP($_FILES['imagem'])));
            }
            $lS = new ListaSlides();
Пример #23
0
 public function getFollowedSlides()
 {
     $this->initConnection();
     $res = array();
     $res_array = $this->dbQuery('SELECT * FROM subscription WHERE item_type="slide" AND user_id=:id', array('id' => $this->id));
     foreach ($res_array as $row) {
         $slide = new Slide();
         $slide->slide_id = $row['item_id'];
         $slide->createFromIDLite($slide->getLastRevisionID());
         $title = $slide->getTitle();
         $slide->title = $slide->shortenTitle($title);
         $res[] = $slide;
     }
     return $res;
 }
Пример #24
0
    <?php 
function spacers()
{
    echo "<br><BR><BR><BR>";
}
/**
        $val = array();
        $result = mysql_query("DESCRIBE slides");
       // $result = mysql_query("INSERT INTO slides (slide) VALUES ('abc')");
           while($data = mysql_fetch_assoc($result)){
           $val[$data["Field"]]=$data["Type"];
            print_r($data);
        }
        print_r($val);
      **/
$s = new Slide();
//echo $s->slide;
//$y=Slide::find(1); // this returns an error when it looks for it's own class';
//Slide::me();
$y = $s->find(1);
//echo "<br><BR><BR><BR> HERE IS Y";
// print_r($y);
//echo "<br><BR><BR><BR> My name is:". $y->slide;
spacers();
$y->slide = "yahoo!!.php";
$y->save();
$z = $s->find_by("id = 2");
echo "here are some objects:<BR>";
foreach ($z as $o) {
    //echo $o->id." ".$o->slide."<br>";
    $o->output_xml();
Пример #25
0
 function reportSlideChanges()
 {
     $this->_template->disableHeader();
     $this->_template->disableFooter();
     $id = @$_GET['slide'];
     $compareTo = @$_GET['compareTo'];
     if (!isset($id)) {
         die("Error in receiving Slide id!");
     }
     $slide1 = new Slide();
     $slide2 = new Slide();
     $slide1->createFromIDLite($id);
     if (!isset($compareTo)) {
         $slide2->id = $slide1->getPreviousRevisionID();
     } else {
         $slide2->id = $compareTo;
     }
     $slide2->createFromIDLite($slide2->id);
     //$slide2->content=$this->tidyhtml($slide2->content);
     //$slide1->content=$this->tidyhtml($slide1->content);
     $this->set('new_content', htmlspecialchars($slide1->content));
     $this->set('old_content', htmlspecialchars($slide2->content));
     $this->set('slide_id', $id);
     //echo $this->htmlDiff($slide2->content, $slide1->content);
 }
Пример #26
0
    </div>
    <div class="portlet-body">
        <div class="table-responsive">
            <table class="table">
                <thead>
                    <tr>

                        <th>图片地址</th>
                        <th>文字说明</th>
                        <th>排序</th>
                        
                    </tr>
                </thead>
                <tbody>
                    <?php 
$model = new Slide();
$de = new CDbCriteria();
$de->order = "sort DESC";
$all = $model->findAll($de);
foreach ($all as $key => $value) {
    $this->renderPartial("_view", array("data" => $value->attributes));
}
?>


                </tbody>
            </table>
        </div>
    </div>
</div>
<!-- END SAMPLE TABLE PORTLET-->
Пример #27
0
 public function getRevisions()
 {
     $res = array();
     foreach ($this->dbQuery('SELECT slide_revision.id, timestamp, content, comment, user_id,  username FROM slide_revision INNER JOIN users ON(user_id=users.id) WHERE slide=' . $this->slide_id . ' ORDER BY timestamp DESC') as $row) {
         $slide = new Slide();
         $slide->createFromID($row['id']);
         $slide->content = $slide->getThumbnailContent();
         $res[] = $slide;
     }
     return $res;
 }
Пример #28
0
<?php

$this->breadcrumbs = array('Slides' => array('index'), 'Create');
$this->menu = array(array('label' => 'List Slides', 'url' => array('index')), array('label' => 'Manage Slides', 'url' => array('admin')));
?>

<h1>Create <?php 
echo Formatter::formatOrdinal(Slide::model()->count() + 1);
?>
 Slide</h1>

<?php 
echo $this->renderPartial('_form', array('model' => $model));
Пример #29
0
 /**
  * @return DataList
  */
 public function getLumberjackChildPages()
 {
     return Slide::get()->filter(array("ParentID" => $this->ID));
 }
Пример #30
0
 public function findSlideByBasic($slide_basic)
 {
     $slide = new Slide();
     $slide_id = $this->dbQuery("SELECT slide_revision.id FROM deck_content JOIN slide_revision ON deck_content.item_id = slide_revision.id WHERE deck_content.deck_revision_id = " . $this->id . " AND deck_content.item_type = 'slide'\tAND slide_revision.slide = " . $slide_basic);
     $slide->createFromID($slide_id['0']['id']);
     $slide->deck = new Deck();
     $slide->deck->id = $slide->getContainerID();
     $slide->deck->title = $slide->deck->getTitle();
     $slide->deck->slug_title = $slide->sluggify($slide->deck->title);
     return $slide;
 }