示例#1
0
 function deck()
 {
     $deck_id = $_GET['deck'];
     $user_id = $this->getCurrentUserID();
     $deck = new Deck();
     $deck->createFromIDLite($deck_id);
     //show error if deck does not exist
     if (!isset($deck->deck_id)) {
         header('Location: ' . BASE_PATH . 'error/404');
         die;
     }
     $style = isset($_GET['style']) ? $_GET['style'] : $deck->default_theme;
     $transition = isset($_GET['transition']) ? $_GET['transition'] : $deck->default_transition;
     if ($user_id) {
         $user = new User();
         $user->createFromID($user_id);
         if (!isset($_GET['style']) && $deck_id) {
             $style = $user->getPreferenceValue('deck-' . $deck_id . '-theme');
         } else {
             $user->setPreferenceValueNoPass('deck-' . $deck_id . '-theme', $_GET['style']);
         }
         if (!isset($_GET['transition']) && $deck_id) {
             $transition = $user->getPreferenceValue('deck-' . $deck_id . '-transition');
         } else {
             $user->setPreferenceValueNoPass('deck-' . $deck_id . '-transition', $_GET['transition']);
         }
     }
     $deck->last_revision_id = $deck->getLastRevisionID();
     $deck->getTranslatedFromChanged();
     $brand = $deck->getBrand();
     $styleObj = new Style();
     $styles = $styleObj->getAll();
     $transitionObj = new Transition();
     $transitions = $transitionObj->getAll();
     $current_user = new User();
     $current_user->createFromID($this->getCurrentUserID());
     $this->set('isFollowing', $current_user->isFollowing('deck', $deck->deck_id));
     $this->set('styles', $styles);
     $this->set('transitions', $transitions);
     $this->set('deck', $deck);
     $this->set('page_title', $deck->title . ' - SlideWiki');
     $this->set('page_keywords', join(',', $deck->getTags($deck->id)));
     $this->set('page_description', $deck->abstract);
     if (!$style) {
         $style = $deck->default_theme;
     }
     $this->set('style', $style);
     if (!$transition) {
         $transition = $deck->default_transition;
     }
     $this->set('transition', $transition);
     $this->set('brand', $brand);
     $this->set('page_additional_footer', '<p><a href="static/deck/' . $deck->id . '_' . $deck->slug_title . '">( Plain Deck )</a></p>');
 }