示例#1
0
 function saveToDB()
 {
     $this->_template->disableHeader();
     $this->_template->disableFooter();
     $this->_noRender = true;
     if (isset($_POST['styles'])) {
         $styles = json_decode($_POST['styles']);
         //first clear the previous transitions
         if (!isset($_SESSION['user']) && !isset($_SESSION['deck'])) {
             die('please login first!');
         }
         $tmp = new ImpressTransition();
         $tmp->user_id = $_SESSION['user'];
         $tmp->deck_id = $_SESSION['deck'];
         $tmp->deleteAllCSS();
         foreach ($styles as $index => $style) {
             $t = new ImpressTransition();
             $t->user_id = $_SESSION['user'];
             $t->deck_id = $_SESSION['deck'];
             $t->slide_position = $index + 1;
             $t->css = $style;
             $t->create();
         }
     } else {
         echo 'All the transitions are saved! See it in action by clicking <a href="./?url=main/playImpress&deck=' . $_SESSION['deck'] . '&style=9">here</a>!<br><br>';
     }
     //var_dump ( $styles );
     //insert styles into db
 }
示例#2
0
 function playImpress()
 {
     $this->_template->disableHeader();
     $this->_template->disableFooter();
     $deckid = $_GET['deck'];
     $deck = new Deck();
     $deck->createFromID($deckid);
     //show error if deck does not exist
     if (!isset($deck->deck_id)) {
         header('Location: ' . BASE_PATH . 'error/404');
         die;
     }
     $user_id = $this->getCurrentUserID();
     if (!$user_id) {
         die('This feature is only available for specific users!<br>');
     }
     $slides = $deck->getSlidesLite(1);
     $deck->slides = $slides;
     $scaling = isset($_GET['scaling']) ? $_GET['scaling'] : 1;
     $style = isset($_GET['style']) ? $_GET['style'] : $deck->default_theme;
     $t = new ImpressTransition();
     $t->user_id = $user_id;
     if (isset($_GET['user'])) {
         $t->user_id = $_GET['user'];
     }
     $t->deck_id = $deckid;
     $transitions = $t->getStylesForUserDeck();
     $show_others_flag = 0;
     $others_transitions = array();
     if (!count($transitions)) {
         $others_transitions = $t->getAllStylesForDeck();
         if (!count($others_transitions)) {
             die('There is no impress transition available!<br>');
         } else {
             $show_others_flag = 1;
         }
     }
     $this->set('transitions', $transitions);
     $this->set('others_transitions', $others_transitions);
     $this->set('style', $style);
     $this->set('scaling', $scaling);
     $this->set('deckObject', $deck);
     $this->set('total', count($deck->slides));
     $this->set('show_others_flag', $show_others_flag);
 }