Ejemplo n.º 1
0
 function loadAdminEventHome()
 {
     // get privileges for the current viewer
     $privManager = new PrivilegeManager($this->viewer->getID());
     if ($privManager->isBasicAdmin($this->EVENT_ID) == true) {
         $links = array();
         $parameters = array();
         //[RAD_CALLBACK_PARAMS]
         $link = $this->getCallBack(modulecim_reg::PAGE_ADMINHOME, '', $parameters);
         $links["BackLink"] = $link;
         if ($privManager->isEventAdmin($this->EVENT_ID) == true) {
             /** Check if recalculation link was clicked **/
             if ($this->IS_RECALC == FinancialTools::RECALC_COMPLETE) {
                 // run recalculation of balance owing
                 $balanceSetter = new FinancialTools();
                 $balanceSetter->recalculateBalances($this->EVENT_ID);
                 $this->IS_RECALC = FinancialTools::RECALC_NOTNEEDED;
                 $eventPriceRules = new RowManager_PriceRuleManager();
                 $eventPriceRules->setEventID($this->EVENT_ID);
                 $eventPriceRules->setPriceRuleType(RowManager_PriceRuleTypeManager::VOLUME_RULE);
                 $ruleList = $eventPriceRules->getListIterator();
                 $ruleArray = $ruleList->getDataList();
                 $ruleIDs = array();
                 reset($ruleArray);
                 // cycle through volume rules
                 foreach (array_keys($ruleArray) as $k) {
                     $record = current($ruleArray);
                     $activeRule = new RowManager_ActiveRuleManager($record['pricerules_id']);
                     $setRecord = array();
                     $setRecord['is_recalculated'] = RowManager_ActiveRuleManager::IS_TRUE;
                     $activeRule->loadFromArray($setRecord);
                     $activeRule->updateDBTable();
                     next($ruleArray);
                 }
             }
             /**  Check if a volume rule exists; if so, check if volume rule triggered ***/
             if ($this->triggerBalanceRecalculation($this->EVENT_ID) == true) {
                 $this->IS_RECALC = FinancialTools::RECALC_NEEDED;
             }
         }
         // end eventAdmin privilege check 1
         // Need to set campus-link so that summary table data can be created for download PDF link
         $parameters = array('EVENT_ID' => $this->EVENT_ID, 'CAMPUS_ID' => $this->CAMPUS_ID);
         //[RAD_CALLBACK_PARAMS]
         $campus_link = $this->getCallBack(modulecim_reg::PAGE_EDITCAMPUSREGISTRATIONS, '', $parameters);
         $campus_link .= "&" . modulecim_reg::CAMPUS_ID . "=";
         $this->pageDisplay = new page_AdminEventHome($this->moduleRootPath, $this->viewer, $this->EVENT_ID, $this->IS_RECALC, $campus_link);
         // set the pageCallBack to be without any additional parameters
         // (an AdminBox needs this so Language Switching on a page doesn't
         // pass a previous operations)
         $parameters = array('EVENT_ID' => $this->EVENT_ID, 'CAMPUS_ID' => $this->CAMPUS_ID);
         //[RAD_CALLBACK_PARAMS]
         $pageCallBack = $this->getCallBack(modulecim_reg::PAGE_ADMINEVENTHOME, $this->sortBy, $parameters);
         $this->setPageCallBack($pageCallBack);
         if ($privManager->isSuperAdmin() == true) {
             $parameters = array('EVENT_ID' => $this->EVENT_ID, 'CAMPUS_ID' => $this->CAMPUS_ID);
             //[RAD_CALLBACK_PARAMS]
             $link = $this->getCallBack(modulecim_reg::PAGE_EDITFIELDTYPES, '', $parameters);
             $links["EditFieldTypes"] = $link;
             $link = $this->getCallBack(modulecim_reg::PAGE_EDITPRICERULETYPES, '', $parameters);
             $links["EditPriceRuleTypes"] = $link;
             $link = $this->getCallBack(modulecim_reg::PAGE_EDITCREDITCARDTYPES, '', $parameters);
             $links["EditCreditCardTypes"] = $link;
             $link = $this->getCallBack(modulecim_reg::PAGE_EDITPRIVILEGETYPES, '', $parameters);
             $links["EditPrivilegeTypes"] = $link;
             $link = $this->getCallBack(modulecim_reg::PAGE_ADDSUPERADMIN, '', $parameters);
             $links["AddSuperAdmins"] = $link;
             $link = $this->getCallBack(modulecim_reg::PAGE_EDITSTATUSES, '', $parameters);
             $links["EditStatusTypes"] = $link;
         }
         //         	  if ($privManager->isCampusAdmin($this->EVENT_ID,null)==true)	// check if privilege level is high enough
         // 	        {
         $links["CampusLink"] = $campus_link;
         // 	        }
         if ($privManager->isEventAdmin($this->EVENT_ID) == true) {
             /**** NOTE: PDF generation TEMPORARILY disabled until PDF plugin added to production PHP environment ****/
             /** GENERATE PDF OF SUMMARY DATA **/
             $fileName = 'summary' . rand(1, MAX_TEMP_SEED) . '.pdf';
             $filePath = getcwd() . "/Reports/" . $fileName;
             // change to '\\' for local use ?
             $linkPath = SITE_PATH_REPORTS . $fileName;
             $page_margin = 20;
             $column_widths = array();
             $column_widths[0] = 0;
             $column_widths[1] = 195;
             //campus
             $column_widths[2] = 70;
             // link
             $column_widths[3] = 35;
             // males total
             $column_widths[4] = 50;
             // females total
             $column_widths[5] = 30;
             // both genders total
             $column_widths[6] = 70;
             // cancellations
             $column_widths[7] = 55;
             // completed regs
             $column_widths[8] = 55;
             // incomplete regs
             $table_pdf = new PDF_Template_Table($filePath, $page_margin, $column_widths, "Registrations");
             $table_pdf->generateTable();
             //(true,true);
             // 				  $metaRegSummaryHeadings = $this->pageDisplay->getMetaSummaryHeadings();
             $metaRegSummaryData = $this->pageDisplay->getMetaSummaryData();
             $campusRegSummaryHeadings = $this->pageDisplay->getSummaryHeadings();
             $campusRegSummaryData = $this->pageDisplay->getSummaryData();
             // 				  echo 'summary data = <pre>'.print_r($campusRegSummaryData,true).'</pre>';
             $table_pdf->fillTable($campusRegSummaryHeadings, $metaRegSummaryData, $campusRegSummaryData, true, true);
             /*** Add a pie chart of campus registrations  **/
             $chart_pdf = new PDF_Template_Charts($table_pdf->getPDF());
             $event = new RowManager_EventManager($this->EVENT_ID);
             $title = 'Total Campus Registrations for ' . $event->getEventName();
             $chart_width = 5;
             //PDF::PAGEWIDTH_LETTER*0.5;
             $chart_height = 5;
             //PDF::PAGEHEIGHT_LETTER*0.5;
             // 					echo 'chart height/width = '.$chart_height.', '.$chart_height;
             $found_nonzero = false;
             $campus_totals = array();
             reset($campusRegSummaryData);
             foreach (array_keys($campusRegSummaryData) as $key) {
                 $record = current($campusRegSummaryData);
                 $campus_totals[$key] = $record['campusTotal'];
                 if ($record['campusTotal'] > 0) {
                     $found_nonzero = true;
                 }
                 next($campusRegSummaryData);
             }
             // 				  echo 'campus totals data = <pre>'.print_r($campus_totals,true).'</pre>';
             // required to avoid divide-by-zero error when generating pie chart with no data
             if ($found_nonzero == true) {
                 $chart_pdf->createPieChart($title, $chart_width, $chart_height, $campus_totals);
             }
             $table_pdf->Output();
             $link = $linkPath;
             $links["DownloadSummary"] = $link;
             /** <END> PDF GENERATION **/
             $emailPageParameters = array('EVENT_ID' => $this->EVENT_ID);
             //[RAD_CALLBACK_PARAMS]
             $email_link = $this->getCallBack(modulecim_reg::PAGE_EMAILCOMPOSER, '', $emailPageParameters);
             $links["EmailRegistrants"] = $email_link;
             $link = $this->getCallBack(modulecim_reg::PAGE_EVENTDETAILS, '', $parameters);
             $links["EditEventDetails"] = $link;
             $link = $this->getCallBack(modulecim_reg::PAGE_ADDEVENTADMIN, '', $parameters);
             $links["AddEventAdmins"] = $link;
             $link = $this->getCallBack(modulecim_reg::PAGE_ADDCAMPUSADMIN, '', $parameters);
             $links["AddCampusAdmins"] = $link;
             $this->IS_RECALC = FinancialTools::RECALC_COMPLETE;
             $recalcParams = array('IS_RECALC' => $this->IS_RECALC, 'EVENT_ID' => $this->EVENT_ID, 'CAMPUS_ID' => $this->CAMPUS_ID);
             $link = $this->getCallBack(modulecim_reg::PAGE_ADMINEVENTHOME, '', $recalcParams);
             $links["RecalculateBalances"] = $link;
             $link = $this->getCallBack(modulecim_reg::PAGE_EDITFORMFIELDS, '', $parameters);
             $links["EditEventFormFields"] = $link;
             $link = $this->getCallBack(modulecim_reg::PAGE_EDITPRICERULES, '', $parameters);
             $links["EditEventPriceRules"] = $link;
             /* Output the file to be downloaded */
             /*        if (isset($this->DOWNLOAD_TYPE))	//($_REQUEST["file"]))	//		//if (isset($_REQUEST["file"])) {
             		        {	
             			        $fileDir = SITE_PATH_REPORTS;
             			        
             			        echo "Data type = ".$this->DOWNLOAD_TYPE;    
             			        switch($this->DOWNLOAD_TYPE)
             			        {
             				        case modulecim_reg::DOWNLOAD_EVENT_DATA:    
             				        		$fileName = $this->getSummaryData($this->EVENT_ID, 1);	//$_REQUEST["file"];	
             				        		echo "FILE NAME = ".$fileName;					
             					    		$file=$fileDir.$fileName;
             					    		
             		//			    		echo "headers: <pre>".print_r(headers_list(),true)."</pre><br>";
             					    		
             					    		// TODO: move below code out of SWITCH
             					    		 header("Content-Location: ".$file);
             							    header("Content-type: text/comma-separated-values");
             							    header("Content-Transfer-Encoding: Binary");
             							    header("Content-length: ".filesize($file));
             							    header("Content-disposition: attachment; filename=\"".basename($file)."\"");
             							    readfile("$file");
             							    
             		
             					    		break;
             					     case modulecim_reg::DOWNLOAD_SCHOLARSHIP_DATA:
             		/*		        		$fileName = $this->getSummaryData($this->EVENT_ID, 1);	//$_REQUEST["file"];	
             				        		echo "FILE NAME = ".$fileName;					
             					    		$file=$fileDir.$fileName;
             					    		
             					    		// TODO: move below code out of SWITCH
             							    header("Content-type: text/comma-separated-values");
             							    header("Content-Transfer-Encoding: Binary");
             							    header("Content-length: ".filesize($file));
             							    header("Content-disposition: attachment; filename=\"".basename($file)."\"");
             							    readfile("$file"); */
             /*			     		echo "NOT YET IMPLEMENTED";
             					     		break;
             					     default:
             					     		break;
             				     }
             				     unset($this->DOWNLOAD_TYPE);
             		
             					} else {
             					    echo "No file selected";
             					} 
             					/** above code gratefully modified from code found at: 
             						http://www.higherpass.com/php/tutorials/File-Download-Security/1/ **/
             //$this->DOWNLOAD_TYPE = modulecim_reg::DOWNLOAD_EVENT_DATA;
             //$fileDownloadParameters = array('EVENT_ID'=>$this->EVENT_ID , 'CAMPUS_ID'=>$this->CAMPUS_ID, 'DOWNLOAD_TYPE'=>$this->DOWNLOAD_TYPE);//[RAD_CALLBACK_PARAMS]
             //        $link2 = SITE_PATH_MODULES.'app_'.modulecim_reg::MODULE_KEY.'/objects_pages/'.modulecim_reg::CSV_DOWNLOAD_TOOL.'?'.modulecim_reg::EVENT_ID.'='.$this->EVENT_ID.'&'.modulecim_reg::DOWNLOAD_TYPE.'='.modulecim_reg::DOWNLOAD_EVENT_DATA;	//$this->getCallBack( modulecim_reg::PAGE_ADMINEVENTHOME, '', $fileDownloadParameters );
             //        $links["EventDataDump"] = $link2;             //Event Data Dump - for importing into Excel
             $this->DOWNLOAD_TYPE = modulecim_reg::DOWNLOAD_EVENT_DATA;
             $fileDownloadParameters = array('EVENT_ID' => $this->EVENT_ID, 'CAMPUS_ID' => $this->CAMPUS_ID, 'DOWNLOAD_TYPE' => $this->DOWNLOAD_TYPE);
             //[RAD_CALLBACK_PARAMS]
             $link2 = $this->getCallBack(modulecim_reg::PAGE_DOWNLOADREPORT, '', $fileDownloadParameters);
             $links["EventDataDump"] = $link2;
             //Event Data Dump - for importing into Excel
             $this->DOWNLOAD_TYPE = modulecim_reg::DOWNLOAD_SCHOLARSHIP_DATA;
             $fileDownloadParameters = array('EVENT_ID' => $this->EVENT_ID, 'CAMPUS_ID' => $this->CAMPUS_ID, 'DOWNLOAD_TYPE' => $this->DOWNLOAD_TYPE);
             //[RAD_CALLBACK_PARAMS]
             $link3 = $this->getCallBack(modulecim_reg::PAGE_DOWNLOADREPORT, '', $fileDownloadParameters);
             $links["EventScholarshipList"] = $link3;
             //Event Scholarship List - for importing into Excel
         }
         // end event-admin privilege check 2
         /*[RAD_LINK_INSERT]*/
         $this->pageDisplay->setLinks($links);
         //$this->previous_page = modulecim_reg::PAGE_ADMINEVENTHOME;
     } else {
         $this->pageDisplay = new page_NotAuthorized($this->moduleRootPath, $this->viewer);
     }
 }
Ejemplo n.º 2
0
    * ccreceipt_moddate [DATE]  The timestamp of when the receipt was created (or modified... but preferably no modifications are made).
    * cctransaction_id [INTEGER]  The unique identifier of a CC transaction to associate with this Moneris receipt.
    */
    $Receipt = new RowManager_ReceiptManager();
    $Receipt->dropTable();
    $Receipt->createTable();
    /*
     * ActiveRule Table
     *
     * Used to determine whether the associated (volume) price rule has been triggered. Also keeps track of whether balance-owing recalculation has been executed yet.
     *
     * pricerules_id [INTEGER]  Unique identifier of the associated price rule.
     * is_active [INTEGER]  Indicates whether the (volume) price rule has already been made active or not.
     * is_recalculated [INTEGER]  This is a flag indicating whether a balance-owing recalculation has been run yet with the 'is_active' flag being in its current state.
     */
    $ActiveRule = new RowManager_ActiveRuleManager();
    $ActiveRule->dropTable();
    $ActiveRule->createTable();
    /*[RAD_DAOBJ_TABLE]*/
} else {
    echo 'Skipping Tables ... <br>';
}
// end if !skipTables
// check to see if parameter 'skipLabel' was provided
$skipLabel = isset($_REQUEST['skipLabel']);
// if not, then add labels to DB ...
if (!$skipLabel) {
    /*
     *  Insert Labels in DB
     */
    // Create Application Upload Series
Ejemplo n.º 3
0
 /**
  * function deleteEntry
  * <pre>
  * Removes the DB table info.
  * </pre>
  * @return [void]
  */
 function deleteEntry()
 {
     parent::deleteEntry();
     if ($this->isVolumePriceRule() == true) {
         // create a record for tracking whether a volume rule is active
         $activeRule = new RowManager_ActiveRuleManager($this->getID());
         $activeRule->deleteEntry();
     }
 }