예제 #1
0
/**
 * Aligns articles published under given publisher folder
 * @param eZContentObject $publisherObject
 */
function alignArticle( $publisherObject, $checkModified = false, $checkLocations = false, $checkLanguages = false, $checkHidden = false, $timingDelay = 0, $forceLast = 0, $sleepTime = 1 )
{
	echo "Starting treatment of publisher folder : " . $publisherObject->name() . "\n";
	echo "Fetching solr informations\n";
	$eZSolr        = eZSearch::getEngine();
	$offset        = 0;
    $forced        = 0;
	$limit         = 200;
	$publisherNode = $publisherObject->mainNode();
	$doCheck       = $checkModified || $checkLocations || $checkLanguages || $checkHidden;
	$solrInfos     = fetchSolrPublisherFolder ( $publisherNode, $checkModified, $checkLocations, $checkLanguages, $checkHidden, $sleepTime );
	
	echo "Solr count : " . count($solrInfos) . "\n";

	while ( true )
	{
		$params = array(
				'Offset'           => $offset,
				'Limit'            => $limit,
				'ClassFilterType'  => 'include',
				'ClassFilterArray' => array( 'article' ),
				'LoadDataMap'      => false,
				'AsObject'         => false,
				'MainNodeOnly'     => true,
		);
        
        if ($forceLast > 0)
            $params['SortBy'] = array ( array('published', false ) );

		$nodeList = $publisherNode->subtree( $params );
		echo "\neZ Offset : $offset\n";

		if ( count( $nodeList ) == 0 )
		{
			break;
		}
	
		foreach ( $nodeList as $mainNode )
		{
			$nodeId = $mainNode['node_id'];
			$objectId = $mainNode['contentobject_id'];
			$toUpdate = false;

            if ( $forceLast > 0 && $forced < $forceLast )
                $toUpdate = true;
			elseif ( isset($solrInfos[$nodeId]) )
			{
				if ( $doCheck )
				{
					if ( $checkLanguages )
					{
						$eZLanguages = eZContentObject::fetch($objectId)->languages();
						$toUpdate = compareLanguages( array_keys($eZLanguages), $solrInfos[$nodeId]['languages'] );
						
						showInvalidTranslations(array_keys($eZLanguages), $solrInfos[$nodeId]['languages'], $objectId);
					}

					if (!$toUpdate && $checkModified)
						$toUpdate = compareDates($mainNode['modified'], $solrInfos[$nodeId]['modified'], $timingDelay);

					if (!$toUpdate && $checkLocations)
						$toUpdate = compareLocations($objectId, $solrInfos[$nodeId]['locations']);

                    if (!$toUpdate && $checkHidden)
                        $toUpdate = compareHidden($objectId, $solrInfos[$nodeId]['hiddenCount'], $solrInfos[$nodeId]['notHiddenCount']);
				}

				unset($solrInfos[$nodeId]);
			}
			else
				$toUpdate = true;

			if ( $toUpdate )
			{
				$return = $eZSolr->addObject( eZContentObject::fetch($objectId), false );

				echo ( !$return ? '!' . $objectId . '!' : '+' );
			}
			else
				echo '-';
            
            $forced++;
		}
	
		$offset += $limit;

		eZContentObject::clearCache();
        
        if ( $sleepTime > 0 )
            sleep ($sleepTime);
	}
	
	echo "\nArticles in solr but unknown from eZPublish : " . count($solrInfos) . " articles\n";
}
     $currentExam .= "</td><td>";
     //$currentExam .= "<br/>";
     $currentExam .= showConcepts($record, $exam_length, true);
     $currentExam .= "</td></tr>";
     $currentExam .= "<tr><td valign='top'>";
     $currentExam .= print_single_button('', null, 'Exam Part II: Implementation!', 'get', '', true, '', true);
     $currentExam .= "</td><td>";
     //$currentExam .= "<br/>";
     $currentExam .= showImplementation($record, $exam_length, true);
     $currentExam .= "</td></tr>";
     $currentExam .= "</table>";
     // End Structure
     $currentExam .= print_container_end(true);
     $currentExam .= "<hr/>";
 } else {
     if (compareDates(date("Y-m-d", $currentTime), date("Y-m-d", $record->endtime)) > 0) {
         // Exam Over 1";
         $record = updateExamStatus($record, "Graded");
         // Page Structure
         $prevExam .= "<table border='0' cellpadding='5' cellspacing='5'>";
         $prevExam .= "<tr><td valign='top'>";
         // Print Status - Checks if the exam was taken, via the quiz grade
         if ($record->grade1 != null) {
             $prevExam .= examStatus($record, array(6), "", true);
         } else {
             $prevExam .= examStatus($record, array(0), "", true);
         }
         $prevExam .= "</td></tr>";
         $prevExam .= "<tr><td>";
         $prevExam .= displayExamInfo($record, $exam_length, true);
         $prevExam .= "</td></tr>";
예제 #3
0
    $record->starttime = date("U",mktime(22,30,0,9,27,2009));
    $record->endtime = date("U",mktime(0,30,0,9,28,2009));
    $records[1] = array($record); 
*/
echo date('U', $now) . "<br />";
echo date('l dS \\of F Y', $now) . "<br />";
echo date('h:i:s A', $now) . "<br /><br /><br />";
foreach ($records as $record) {
    //echo date('U', $record->starttime)."<br />";
    if (compareDates(date("Y-m-d", $now), date("Y-m-d", $record->starttime)) < 0) {
        //echo "Your Exam is has NOT started<br />";
        examStatus(array(1));
        echo "Your Exam is on:<br/>";
        displayExamInfo($record, $exam_length);
    } else {
        if (compareDates(date("Y-m-d", $now), date("Y-m-d", $record->endtime)) > 0) {
            //echo "Your Exam is OVER. Practical is Over. -- View Grades<br />";
            examStatus(array(6));
            displayExamInfo($record, $exam_length);
            showGrades($record);
        } else {
            //Exam Day
            $starttime = $record->starttime;
            $endtime = $record->endtime;
            if ($now < $starttime) {
                //echo "Your Exam is has NOT STARTED<br />";
                //examStatus(1);
                // Exam Instructions
                if ($now >= $starttime - 1800) {
                    //echo"<font color='green'>Your Exam Instructions are available.</font><br/><br/>";
                    examStatus(array(1, 2));
예제 #4
0
파일: CronJobs.php 프로젝트: buseamy/GR-JCI
        }
    } else {
        if (compareDates($today, $FirstReviewDueDate)) {
            //Get the reviewers list for nagging emails
            $Reviewers = mysqli_query($dbc, 'Call spNagReviewersGetList();');
            complete_procedure($dbc);
            if (mysqli_num_rows($Reviewers) > 0) {
                while ($row = $Reviewers->fetch_assoc()) {
                    $To = $row["EmailAddress"];
                    $Message = str_replace('{0}', $row["FirstName"] . ' ' . $row["LastName"], $ReviewerBodyTemplate);
                    //Send the email
                    sendNagEmail($To, $ReviewerSubjectTemplate, $Message);
                }
            }
        } else {
            if (compareDates($today, $SecondReviewDueDate)) {
                //Get the reviewers list for nagging emails
                $Reviewers = mysqli_query($dbc, 'Call spNagReviewersGetList();');
                complete_procedure($dbc);
                if (mysqli_num_rows($Reviewers) > 0) {
                    while ($row = $Reviewers->fetch_assoc()) {
                        $To = $row["EmailAddress"];
                        $Message = str_replace('{0}', $row["FirstName"] . ' ' . $row["LastName"], $ReviewerBodyTemplate);
                        //Send the email
                        sendNagEmail($To, $ReviewerSubjectTemplate, $Message);
                    }
                }
            }
        }
    }
}
             }
             $text = "CHECKING REMOTE SERVER FOR NEW CSV SOURCE FILES \n\n";
             $text .= "Filename: " . $remoteDirFile . "\n";
             $text .= "Remote Version: " . formatDate($remoteFileDate) . $updateText . "\n";
             $text .= "Local Version:  " . formatDate($localFileDate) . "\n\n";
         }
     }
     foreach ($config['settings']['csv_secondary'] as $item => $value) {
         if ($value == "TRUE") {
             $localDirFile = $config['dir_path'] . $config['settings']['csv_local_url'][$item];
             $remoteDirFile = $config['settings']['csv_remote_url'][$item];
             $remoteFileDate = GetRemoteLastModified($remoteDirFile);
             $localFileDate = GetLocalLastModified($localDirFile);
             //Compare dates. If remote file is newer then display.
             $updateText = "";
             if (compareDates($remoteFileDate, $localFileDate) == TRUE) {
                 $updateText = "  <=== NEW UPDATE AVALIBLE!!";
             }
             $text .= "Filename: " . $remoteDirFile . "\n";
             $text .= "Remote Version: " . formatDate($remoteFileDate) . $updateText . "\n";
             $text .= "Local Version:  " . formatDate($localFileDate) . "\n\n";
         }
     }
     echo $text;
     break;
     //DOWNLOAD Option
 //DOWNLOAD Option
 case "-d":
     //TODO
     $text = "Download new updates.\n\n";
     $text .= "\n\n";