コード例 #1
0
 function launch()
 {
     global $interface;
     global $configArray;
     $purchaseRatio = $configArray['EContent']['holdRatioForPurchase'];
     $interface->setPageTitle('eContent Purchase Alert');
     //Load the list of eContent Reocrds that have more than 4 times as many holds as items
     $eContentRecord = new EContentRecord();
     if (isset($_REQUEST['sourceFilter'])) {
         $sourcesToShow = $_REQUEST['sourceFilter'];
         foreach ($sourcesToShow as $key => $item) {
             $sourcesToShow[$key] = "'" . mysql_escape_string(strip_tags($item)) . "'";
         }
         $sourceRestriction = " WHERE source IN (" . join(",", $sourcesToShow) . ") ";
     }
     $eContentRecord->query("SELECT econtent_record.id, title, author, isbn, ilsId, source, count(econtent_hold.id) as numHolds, availableCopies, onOrderCopies " . "FROM econtent_record " . "LEFT JOIN econtent_hold ON econtent_record.id = econtent_hold.recordId " . "WHERE econtent_hold.status " . "IN ( " . "'active', 'suspended' " . ") " . "GROUP BY econtent_record.id");
     $recordsToPurchase = array();
     while ($eContentRecord->fetch()) {
         $totalCopies = $eContentRecord->availableCopies + $eContentRecord->onOrderCopies;
         if ($eContentRecord->numHolds > $purchaseRatio * $totalCopies) {
             $eContentRecord->totalCopies = $totalCopies;
             $recordsToPurchase[] = clone $eContentRecord;
         }
     }
     $interface->assign('recordsToPurchase', $recordsToPurchase);
     //EXPORT To EXCEL
     if (isset($_REQUEST['exportToExcel'])) {
         $this->exportToExcel($recordsToPurchase);
     }
     $interface->assign('sidebar', 'MyAccount/account-sidebar.tpl');
     $interface->setTemplate('econtentPurchaseAlert.tpl');
     $interface->display('layout.tpl');
 }
コード例 #2
0
 function launch()
 {
     global $interface;
     $interface->setPageTitle('eContent Trial Records');
     //Load the list of eContent Reocrds that have more than 4 times as many holds as items
     $eContentRecord = new EContentRecord();
     if (isset($_REQUEST['sourceFilter'])) {
         $sourcesToShow = $_REQUEST['sourceFilter'];
         foreach ($sourcesToShow as $key => $item) {
             $sourcesToShow[$key] = "'" . mysql_escape_string(strip_tags($item)) . "'";
         }
         $sourceRestriction = " WHERE source IN (" . join(",", $sourcesToShow) . ") ";
     }
     $eContentRecord->query("SELECT econtent_record.id, title, author, source, count(DISTINCT econtent_checkout.userId) as numCheckouts FROM econtent_record LEFT JOIN econtent_checkout on econtent_record.id = econtent_checkout.recordId WHERE trialTitle = 1 GROUP BY econtent_record.id");
     $trialRecordsToPurchase = array();
     while ($eContentRecord->fetch()) {
         if ($eContentRecord->numCheckouts > 3) {
             $trialRecordsToPurchase[] = clone $eContentRecord;
         }
     }
     $interface->assign('trialRecordsToPurchase', $trialRecordsToPurchase);
     $interface->assign('sidebar', 'MyAccount/account-sidebar.tpl');
     $interface->setTemplate('econtentTrialRecords.tpl');
     $interface->display('layout.tpl');
 }
コード例 #3
0
 function getSourceFilter()
 {
     $eContentRecord = new EContentRecord();
     //Populate the Source Filter
     $querySourceFilter = "select distinct source from econtent_record where econtent_record.id not in (select recordId from econtent_item) and status = 'active' " . "ORDER BY source ASC";
     $eContentRecord->query($querySourceFilter);
     $resultsSourceFilter = array();
     $i = 0;
     while ($eContentRecord->fetch()) {
         $tmp = array('SourceValue' => $eContentRecord->source);
         $resultsSourceFilter[$i++] = $tmp;
     }
     return $resultsSourceFilter;
 }
コード例 #4
0
 function launch()
 {
     global $interface;
     $interface->setPageTitle('eContent WishList');
     //Load the list of eContent Records that people have added to their wishlist
     $eContentRecord = new EContentRecord();
     $eContentRecord->query("SELECT econtent_record.id, title, author, source, ilsId, isbn, count(DISTINCT econtent_wishlist.userId) as numWishList FROM econtent_record INNER JOIN econtent_wishlist on econtent_record.id = econtent_wishlist.recordId WHERE econtent_wishlist.status = 'active' GROUP BY econtent_record.id ORDER BY numWishList DESC, title ASC");
     $recordsOnWishList = array();
     while ($eContentRecord->fetch()) {
         $recordsOnWishList[] = clone $eContentRecord;
     }
     $interface->assign('recordsOnWishList', $recordsOnWishList);
     //EXPORT To EXCEL
     if (isset($_REQUEST['exportToExcel'])) {
         $this->exportToExcel($recordsOnWishList);
     }
     $interface->setTemplate('econtentWishlist.tpl');
     $interface->display('layout.tpl');
 }
コード例 #5
0
 function loadCollectionSummary()
 {
     $collectionSummary = array();
     $epubFile = new EContentRecord();
     $query = "SELECT COUNT(DISTINCT id) as numTitles FROM `econtent_record` where status = 'active'";
     $epubFile->query($query);
     if ($epubFile->N > 0) {
         $epubFile->fetch();
         $collectionSummary['numTitles'] = $epubFile->numTitles;
     }
     $statsByDRM = new EContentRecord();
     $query = "SELECT accessType, COUNT(DISTINCT id) as numTitles FROM `econtent_record` where status = 'active' GROUP BY accessType ORDER BY accessType ASC";
     $statsByDRM->query($query);
     while ($statsByDRM->fetch()) {
         $collectionSummary['statsByDRM'][$statsByDRM->accessType] = $statsByDRM->numTitles;
     }
     $statsBySource = new EContentRecord();
     $query = "SELECT source, COUNT(DISTINCT id) as numTitles FROM `econtent_record` where status = 'active' GROUP BY source ORDER BY source ASC";
     $statsBySource->query($query);
     while ($statsBySource->fetch()) {
         $collectionSummary['statsBySource'][$statsBySource->source] = $statsBySource->numTitles;
     }
     return $collectionSummary;
 }
コード例 #6
0
 function getSourceFilter()
 {
     //Populate the Source Filter
     $econtentRecord = new EContentRecord();
     $querySourceFilter = "SELECT DISTINCT source FROM econtent_record WHERE source IS NOT NULL AND source <> '' " . "ORDER BY source ASC";
     $econtentRecord->query($querySourceFilter);
     $resultsSourceFilter = array();
     $i = 0;
     while ($econtentRecord->fetch()) {
         $tmp = array('SourceValue' => $econtentRecord->source);
         $resultsSourceFilter[$i++] = $tmp;
     }
     return $resultsSourceFilter;
 }
コード例 #7
0
 function loadEContentSources()
 {
     $sources = array();
     $econtentRecord = new EContentRecord();
     $econtentRecord->query("SELECT DISTINCT source FROM econtent_record ORDER BY source");
     while ($econtentRecord->fetch()) {
         $sources[] = $econtentRecord->source;
     }
     return $sources;
 }
コード例 #8
0
 function launch()
 {
     global $interface;
     global $configArray;
     $interface->setPageTitle('Transfer Account Information');
     if (isset($_REQUEST['submit'])) {
         $message = "";
         $okToTransfer = true;
         //Get the old user id
         $oldUser = new User();
         $oldUser->cat_username = $_REQUEST['oldBarcode'];
         if (!$oldUser->find(true)) {
             $message .= "<p>Sorry, we could not find a user for the old barcode.  Unable to transfer information.</p>";
             $okToTransfer = false;
         }
         //Get the new user id
         $newUser = new User();
         $newUser->cat_username = $_REQUEST['newBarcode'];
         if (!$newUser->find(true)) {
             $message .= "<p>Sorry, we could not find a user for the new barcode.  Unable to transfer information.</p>";
             $okToTransfer = false;
         }
         if ($okToTransfer) {
             require_once ROOT_DIR . '/services/MyResearch/lib/Resource.php';
             require_once ROOT_DIR . '/sys/eContent/EContentRecord.php';
             //Transfer ratings for regular titles
             $message .= "<p>Transfered: <ul>";
             $resource = new Resource();
             $ret = $resource->query("UPDATE user_rating set userid = {$newUser->id} WHERE userid = {$oldUser->id}");
             $message .= "<li>{$ret} Ratings of print titles</li>";
             //Transfer reading history
             $resource = new Resource();
             $ret = $resource->query("UPDATE user_reading_history set userid = {$newUser->id} WHERE userid = {$oldUser->id}");
             $message .= "<li>{$ret} Reading History Entries</li>";
             //Transfer comments
             $resource = new Resource();
             $ret = $resource->query("UPDATE comments set user_id = {$newUser->id} WHERE user_id = {$oldUser->id}");
             $message .= "<li>{$ret} Reviews</li>";
             //Transfer tags
             $resource = new Resource();
             $ret = $resource->query("UPDATE resource_tags set user_id = {$newUser->id} WHERE user_id = {$oldUser->id}");
             $message .= "<li>{$ret} Tags</li>";
             //Transfer lists
             $resource = new Resource();
             $ret = $resource->query("UPDATE user_list set user_id = {$newUser->id} WHERE user_id = {$oldUser->id}");
             $message .= "<li>{$ret} User Lists</li>";
             //Transfer eContent ratings
             $eContentRecord = new EContentRecord();
             $ret = $eContentRecord->query("UPDATE econtent_rating set userId = {$newUser->id} WHERE userId = {$oldUser->id}");
             $message .= "<li>{$ret} Ratings of eContent titles</li>";
             //Transfer eContent checkouts
             $eContentRecord = new EContentRecord();
             $ret = $eContentRecord->query("UPDATE econtent_checkout set userId = {$newUser->id} WHERE userId = {$oldUser->id}");
             $message .= "<li>{$ret} eContent Checkouts</li>";
             //Transfer eContent holds
             $eContentRecord = new EContentRecord();
             $ret = $eContentRecord->query("UPDATE econtent_hold set userId = {$newUser->id} WHERE userId = {$oldUser->id}");
             $message .= "<li>{$ret} eContent Holds</li>";
             //Transfer eContent wishlist
             $eContentRecord = new EContentRecord();
             $ret = $eContentRecord->query("UPDATE econtent_wishlist set userId = {$newUser->id} WHERE userId = {$oldUser->id}");
             $message .= "<li>{$ret} eContent Wish List Entries</li>";
             $message .= "</ul></p>";
         }
         $interface->assign('message', $message);
     }
     $interface->assign('sidebar', 'MyAccount/account-sidebar.tpl');
     $interface->setTemplate('transferAccountInfo.tpl');
     $interface->display('layout.tpl');
 }