コード例 #1
0
ファイル: EmailList.php プロジェクト: bryandease/VuFind-Plus
 function sendEmail($to, $from, $message)
 {
     global $interface;
     global $user;
     //Load the list
     $list = new User_list();
     $list->id = $_REQUEST['listId'];
     if ($list->find(true)) {
         // Build Favorites List
         $titles = $list->getResources(null);
         // Load the User object for the owner of the list (if necessary):
         if ($user && $user->id == $list->user_id || $list->public == 1) {
             //The user can access the list
             $favoriteHandler = new FavoriteHandler($titles, $user);
             $titleDetails = $favoriteHandler->getTitles();
             $interface->assign('titles', $titleDetails);
             $interface->assign('list', $list);
         } else {
             $interface->assign('error', 'You do not have access to this list.');
         }
     } else {
         $interface->assign('error', 'Unable to read list');
     }
     $interface->assign('from', $from);
     $interface->assign('message', $message);
     $body = $interface->fetch('Emails/my-list.tpl');
     $mail = new VuFindMailer();
     $subject = $list->title;
     return $mail->send($to, $from, $subject, $body);
 }
コード例 #2
0
ファイル: ListAPI.php プロジェクト: bryandease/VuFind-Plus
 private function _getUserListTitles($listId)
 {
     global $user;
     //The list is a patron generated list
     $list = new User_list();
     $list->id = $listId;
     if ($list->find(true)) {
         //Make sure the user has acess to the list
         if ($list->public == 0) {
             if (!$user) {
                 return array('success' => false, 'message' => 'The user was invalid.  A valid user must be provided for private lists.');
             } elseif ($list->user_id != $user->id) {
                 return array('success' => false, 'message' => 'The user does not have access to this list.');
             }
         }
         //Load the titles for the list.
         $listResources = $list->getResources();
         $ids = array();
         $datesSaved = array();
         foreach ($listResources as $resource) {
             if ($resource->source == 'VuFind') {
                 $ids[] = $resource->record_id;
             } else {
                 $ids[] = 'econtentRecord' . $resource->record_id;
             }
             $datesSaved[$resource->record_id] = $resource->saved;
         }
         $titles = $this->loadTitleInformationForIds($ids, array(), $datesSaved);
         return array('success' => true, 'listName' => $list->title, 'listDescription' => $list->description, 'titles' => $titles, 'cacheLength' => 24);
     } else {
         return array('success' => false, 'message' => 'The specified list could not be found.');
     }
 }