Ejemplo n.º 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
 }