Exemple #1
0
 function launch()
 {
     global $interface;
     //Get all lists for the user
     // Fetch List object
     if (isset($_REQUEST['id'])) {
         /** @var UserList $list */
         $list = UserList::staticGet($_GET['listId']);
     }
     $interface->assign('favList', $list);
     // Get all titles on the list
     //		$favorites = $list->getListEntries();
     //		$favList = new FavoriteHandler($favorites, null, $list->id, false);
     //TODO: test this
     $favList = new FavoriteHandler($list, null, false);
     $citationFormat = $_REQUEST['citationFormat'];
     $citationFormats = CitationBuilder::getCitationFormats();
     $interface->assign('citationFormat', $citationFormats[$citationFormat]);
     $citations = $favList->getCitations($citationFormat);
     $interface->assign('citations', $citations);
     // Display Page
     $interface->assign('listId', strip_tags($_REQUEST['id']));
     $interface->setTemplate('listCitations.tpl');
     $interface->display('layout.tpl');
 }
Exemple #2
0
 /**
  * Process parameters and display the page.
  *
  * @return void
  * @access public
  */
 public function launch()
 {
     global $interface;
     global $configArray;
     if (!($user = UserAccount::isLoggedIn())) {
         include_once 'Login.php';
         MyAccount_Login::launch();
         exit;
     }
     // Fetch List object
     $list = UserList::staticGet($_GET['id']);
     // Ensure user have privs to view the list
     if ($list->user_id != $user->id) {
         PEAR_Singleton::raiseError(new PEAR_Error(translate('list_access_denied')));
     }
     // Save Data
     if (isset($_POST['submit'])) {
         if (empty($_POST['title'])) {
             $interface->assign('errorMsg', 'list_edit_name_required');
         } else {
             if ($this->_saveChanges($user, $list)) {
                 // After changes are saved, send the user back to an appropriate page
                 $nextAction = 'MyList/' . $list->id;
                 header('Location: ' . $configArray['Site']['path'] . '/MyResearch/' . $nextAction);
                 exit;
             } else {
                 // List was not edited
                 $interface->assign('errorMsg', 'edit_list_fail');
             }
         }
     }
     // Send list to template so title/description can be displayed:
     $interface->assign('list', $list);
     $interface->setTemplate('editList.tpl');
     $interface->display('layout.tpl');
 }