本文整理汇总了PHP中dateShift函数的典型用法代码示例。如果您正苦于以下问题:PHP dateShift函数的具体用法?PHP dateShift怎么用?PHP dateShift使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了dateShift函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: index
/**
* Base function
*
* This functions receives the request to generate a dump file for the
* database and does so! Only superadmins are allowed to do this!
*/
public function index()
{
$sFileName = 'LimeSurvey_' . $sDbName . '_dump_' . dateShift(date('Y-m-d H:i:s'), 'Y-m-d', Yii::app()->getConfig('timeadjust')) . '.sql';
$this->_outputHeaders($sFileName);
Yii::app()->loadHelper("admin/backupdb");
outputDatabase();
exit;
}
示例2: _outputDBDescription
function _outputDBDescription($sDbName, $bAllowExportAllDb)
{
$sOutput = '--' . "\n";
$sOutput .= '-- LimeSurvey Database Dump of `' . $sDbName . '`' . "\n";
if (!$bAllowExportAllDb) {
$sOutput = '-- Only prefixed tables with: ' . Yii::app()->db->tablePrefix . "\n";
}
$sOutput .= '-- Date of Dump: ' . dateShift(date('d-M-Y'), 'd-M-Y', Yii::app()->getConfig('timeadjust')) . "\n";
$sOutput .= '--' . "\n";
return $sOutput;
}
示例3: _init
/**
* Initialises this controller, does some basic checks and setups
*
* @access protected
* @return void
*/
protected function _init()
{
parent::_init();
App()->getComponent('bootstrap');
$sUpdateLastCheck = getGlobalSetting('updatelastcheck');
// echo "111111";
$this->_sessioncontrol();
if (Yii::app()->getConfig('buildnumber') != "" && Yii::app()->getConfig('updatecheckperiod') > 0 && $sUpdateLastCheck < dateShift(date("Y-m-d H:i:s"), "Y-m-d H:i:s", "-" . Yii::app()->getConfig('updatecheckperiod') . " days")) {
updateCheck();
}
//unset(Yii::app()->session['FileManagerContext']);
App()->getClientScript()->registerScriptFile(Yii::app()->getConfig('adminscripts') . "admin_core.js");
$this->user_id = Yii::app()->user->getId();
if (!Yii::app()->getConfig("surveyid")) {
Yii::app()->setConfig("surveyid", returnGlobal('sid'));
}
//SurveyID
if (!Yii::app()->getConfig("ugid")) {
Yii::app()->setConfig("ugid", returnGlobal('ugid'));
}
//Usergroup-ID
if (!Yii::app()->getConfig("gid")) {
Yii::app()->setConfig("gid", returnGlobal('gid'));
}
//GroupID
if (!Yii::app()->getConfig("qid")) {
Yii::app()->setConfig("qid", returnGlobal('qid'));
}
//QuestionID
if (!Yii::app()->getConfig("lid")) {
Yii::app()->setConfig("lid", returnGlobal('lid'));
}
//LabelID
if (!Yii::app()->getConfig("code")) {
Yii::app()->setConfig("code", returnGlobal('code'));
}
// ??
if (!Yii::app()->getConfig("action")) {
Yii::app()->setConfig("action", returnGlobal('action'));
}
//Desired action
if (!Yii::app()->getConfig("subaction")) {
Yii::app()->setConfig("subaction", returnGlobal('subaction'));
}
//Desired subaction
if (!Yii::app()->getConfig("editedaction")) {
Yii::app()->setConfig("editedaction", returnGlobal('editedaction'));
}
// for html editor integration
}
示例4: _init
/**
* Initialises this controller, does some basic checks and setups
*
* @access protected
* @return void
*/
protected function _init()
{
parent::_init();
$updatelastcheck = '';
$this->_sessioncontrol();
if (Yii::app()->getConfig('buildnumber') != "" && Yii::app()->getConfig('updatecheckperiod') > 0 && $updatelastcheck < dateShift(date("Y-m-d H:i:s"), "Y-m-d H:i:s", "-" . Yii::app()->getConfig('updatecheckperiod') . " days")) {
updateCheck();
}
//unset(Yii::app()->session['FileManagerContext']);
$this->user_id = Yii::app()->user->getId();
Yii::app()->setConfig('adminimageurl', Yii::app()->getConfig('styleurl') . Yii::app()->getConfig('admintheme') . '/images/');
Yii::app()->setConfig('adminstyleurl', Yii::app()->getConfig('styleurl') . Yii::app()->getConfig('admintheme') . '/');
if (!Yii::app()->getConfig("surveyid")) {
Yii::app()->setConfig("surveyid", returnGlobal('sid'));
}
//SurveyID
if (!Yii::app()->getConfig("ugid")) {
Yii::app()->setConfig("ugid", returnGlobal('ugid'));
}
//Usergroup-ID
if (!Yii::app()->getConfig("gid")) {
Yii::app()->setConfig("gid", returnGlobal('gid'));
}
//GroupID
if (!Yii::app()->getConfig("qid")) {
Yii::app()->setConfig("qid", returnGlobal('qid'));
}
//QuestionID
if (!Yii::app()->getConfig("lid")) {
Yii::app()->setConfig("lid", returnGlobal('lid'));
}
//LabelID
if (!Yii::app()->getConfig("code")) {
Yii::app()->setConfig("code", returnGlobal('code'));
}
// ??
if (!Yii::app()->getConfig("action")) {
Yii::app()->setConfig("action", returnGlobal('action'));
}
//Desired action
if (!Yii::app()->getConfig("subaction")) {
Yii::app()->setConfig("subaction", returnGlobal('subaction'));
}
//Desired subaction
if (!Yii::app()->getConfig("editedaction")) {
Yii::app()->setConfig("editedaction", returnGlobal('editedaction'));
}
// for html editor integration
}
示例5: _displaySettings
private function _displaySettings()
{
Yii::app()->loadHelper('surveytranslator');
// Save refurl from where global settings screen is called!
// Unless it's called from global settings...
$refurl = Yii::app()->getRequest()->getUrlReferrer();
// Some URLs are not to be allowed to refered back to.
// These exceptions can be added to the $aReplacements array
$aReplacements = array('admin/update/sa/step4b' => 'admin/sa/index', 'admin/user/sa/adduser' => 'admin/user/sa/index', 'admin/user/sa/setusertemplates' => 'admin/user/sa/index');
$refurl = str_replace(array_keys($aReplacements), array_values($aReplacements), $refurl);
// Don't update session variable if refurl is empty (happens when user clicks Save)
if ($refurl !== "") {
Yii::app()->session['refurl'] = htmlspecialchars($refurl);
//just to be safe!
}
$data['title'] = "hi";
$data['message'] = "message";
foreach ($this->_checkSettings() as $key => $row) {
$data[$key] = $row;
}
Yii::app()->loadLibrary('Date_Time_Converter');
$dateformatdetails = getDateFormatData(Yii::app()->session['dateformat']);
$datetimeobj = new date_time_converter(dateShift(getGlobalSetting("updatelastcheck"), 'Y-m-d H:i:s', getGlobalSetting('timeadjust')), 'Y-m-d H:i:s');
$data['updatelastcheck'] = $datetimeobj->convert($dateformatdetails['phpdate'] . " H:i:s");
$data['updateavailable'] = getGlobalSetting("updateavailable") && Yii::app()->getConfig("updatable");
$data['updatable'] = Yii::app()->getConfig("updatable");
$data['updateinfo'] = getGlobalSetting("updateinfo");
$data['updatebuild'] = getGlobalSetting("updatebuild");
$data['updateversion'] = getGlobalSetting("updateversion");
$data['aUpdateVersions'] = json_decode(getGlobalSetting("updateversions"), true);
$data['allLanguages'] = getLanguageData(false, Yii::app()->session['adminlang']);
if (trim(Yii::app()->getConfig('restrictToLanguages')) == '') {
$data['restrictToLanguages'] = array_keys($data['allLanguages']);
$data['excludedLanguages'] = array();
} else {
$data['restrictToLanguages'] = explode(' ', trim(Yii::app()->getConfig('restrictToLanguages')));
$data['excludedLanguages'] = array_diff(array_keys($data['allLanguages']), $data['restrictToLanguages']);
}
$data['fullpagebar']['savebutton']['form'] = 'frmglobalsettings';
$data['fullpagebar']['saveandclosebutton']['form'] = 'frmglobalsettings';
$data['fullpagebar']['closebutton']['url'] = 'admin/';
$this->_renderWrappedTemplate('', 'globalSettings_view', $data);
}
示例6: _displaySettings
private function _displaySettings()
{
Yii::app()->loadHelper('surveytranslator');
// Save refurl from where global settings screen is called!
$refurl = Yii::app()->getRequest()->getUrlReferrer(Yii::app()->createUrl('admin'), array('globalsettings'));
// Some URLs are not to be allowed to refered back to.
// These exceptions can be added to the $aReplacements array
$aReplacements = array('admin/update/sa/step4b' => 'admin/sa/index', 'admin/user/sa/adduser' => 'admin/user/sa/index', 'admin/user/sa/setusertemplates' => 'admin/user/sa/index');
$data['title'] = "hi";
$data['message'] = "message";
foreach ($this->_checkSettings() as $key => $row) {
$data[$key] = $row;
}
Yii::app()->loadLibrary('Date_Time_Converter');
$dateformatdetails = getDateFormatData(Yii::app()->session['dateformat']);
$datetimeobj = new date_time_converter(dateShift(getGlobalSetting("updatelastcheck"), 'Y-m-d H:i:s', getGlobalSetting('timeadjust')), 'Y-m-d H:i:s');
$data['updatelastcheck'] = $datetimeobj->convert($dateformatdetails['phpdate'] . " H:i:s");
$data['updateavailable'] = getGlobalSetting("updateavailable") && Yii::app()->getConfig("updatable");
$data['updatable'] = Yii::app()->getConfig("updatable");
$data['updateinfo'] = getGlobalSetting("updateinfo");
$data['updatebuild'] = getGlobalSetting("updatebuild");
$data['updateversion'] = getGlobalSetting("updateversion");
$data['aUpdateVersions'] = json_decode(getGlobalSetting("updateversions"), true);
$data['allLanguages'] = getLanguageData(false, Yii::app()->session['adminlang']);
if (trim(Yii::app()->getConfig('restrictToLanguages')) == '') {
$data['restrictToLanguages'] = array_keys($data['allLanguages']);
$data['excludedLanguages'] = array();
} else {
$data['restrictToLanguages'] = explode(' ', trim(Yii::app()->getConfig('restrictToLanguages')));
$data['excludedLanguages'] = array_diff(array_keys($data['allLanguages']), $data['restrictToLanguages']);
}
$data['fullpagebar']['savebutton']['form'] = 'frmglobalsettings';
$data['fullpagebar']['saveandclosebutton']['form'] = 'frmglobalsettings';
$data['fullpagebar']['closebutton']['url'] = 'admin/';
// Close button
// List of available encodings
$data['aEncodings'] = aEncodingsArray();
// Get current setting from DB
$data['thischaracterset'] = getGlobalSetting('characterset');
$data['sideMenuBehaviour'] = getGlobalSetting('sideMenuBehaviour');
$data['aListOfThemeObjects'] = AdminTheme::getAdminThemeList();
$this->_renderWrappedTemplate('', 'globalSettings_view', $data);
}
示例7: getDateFormatData
?>
</option>
</select></li>
<?php
$dateformatdata = getDateFormatData(Yii::app()->session['dateformat']);
?>
<li><label for='timeadjust'><?php
$clang->eT("Time difference (in hours):");
?>
</label>
<span><input type='text' size='10' id='timeadjust' name='timeadjust' value="<?php
echo htmlspecialchars(str_replace(array('+', ' hours'), array('', ''), getGlobalSetting('timeadjust')));
?>
" />
<?php
echo $clang->gT("Server time:") . ' ' . convertDateTimeFormat(date('Y-m-d H:i:s'), 'Y-m-d H:i:s', $dateformatdata['phpdate'] . ' H:i') . " - " . $clang->gT("Corrected time :") . ' ' . convertDateTimeFormat(dateShift(date("Y-m-d H:i:s"), 'Y-m-d H:i:s', getGlobalSetting('timeadjust')), 'Y-m-d H:i:s', $dateformatdata['phpdate'] . ' H:i');
?>
</span></li>
<li><label for='iSessionExpirationTime'><?php
$clang->eT("Session lifetime (seconds):");
?>
</label>
<input type='text' size='10' id='iSessionExpirationTime' name='iSessionExpirationTime' value="<?php
echo htmlspecialchars(getGlobalSetting('iSessionExpirationTime'));
?>
" /></li>
<li><label for='ipInfoDbAPIKey'><?php
$clang->eT("IP Info DB API Key:");
?>
</label>
示例8: dateShift
{
$('#submitdata').button("option", "disabled", false);
$('#save-button').prop('disabled', false);
}
else
{
$('#submitdata').button("option", "disabled", true);
$('#save-button').prop('disabled', true);
}
}
//--></script>
</td></tr>
<?php
}
if ($thissurvey['datestamp'] == "Y") {
$localtimedate = dateShift(date("Y-m-d H:i:s"), "Y-m-d H:i", Yii::app()->getConfig('timeadjust'));
?>
<tr>
<td valign='top' width='1%'></td>
<td valign='top' align='right' width='30%'><strong>
<?php
echo gT("Datestamp", 'html', $sDataEntryLanguage);
?>
:</strong></td>
<td valign='top' align='left' style='padding-left: 20px'>
<input type='text' name='datestamp' value='<?php
echo $localtimedate;
?>
' />
</td>
</tr>
示例9: submittokens
/**
* Marks a tokens as completed and sends a confirmation email to the participiant.
* If $quotaexit is set to true then the user exited the survey due to a quota
* restriction and the according token is only marked as 'Q'
*
* @param mixed $quotaexit
*/
function submittokens($quotaexit = false)
{
$surveyid = Yii::app()->getConfig('surveyID');
if (isset($_SESSION['survey_' . $surveyid]['s_lang'])) {
$thissurvey = getSurveyInfo($surveyid, $_SESSION['survey_' . $surveyid]['s_lang']);
} else {
$thissurvey = getSurveyInfo($surveyid);
}
$clienttoken = $_SESSION['survey_' . $surveyid]['token'];
$sitename = Yii::app()->getConfig("sitename");
$emailcharset = Yii::app()->getConfig("emailcharset");
// Shift the date due to global timeadjust setting
$today = dateShift(date("Y-m-d H:i:s"), "Y-m-d H:i", Yii::app()->getConfig("timeadjust"));
// check how many uses the token has left
$token = Token::model($surveyid)->findByAttributes(array('token' => $clienttoken));
if ($quotaexit == true) {
$token->completed = 'Q';
$token->usesleft--;
} else {
if ($token->usesleft <= 1) {
// Finish the token
if (isTokenCompletedDatestamped($thissurvey)) {
$token->completed = $today;
} else {
$token->completed = 'Y';
}
if (isset($token->participant_id)) {
$slquery = SurveyLink::model()->find('participant_id = :pid AND survey_id = :sid AND token_id = :tid', array(':pid' => $token->participant_id, ':sid' => $surveyid, ':tid' => $token->tid));
if ($slquery) {
if (isTokenCompletedDatestamped($thissurvey)) {
$slquery->date_completed = $today;
} else {
// Update the survey_links table if necessary, to protect anonymity, use the date_created field date
$slquery->date_completed = $slquery->date_created;
}
$slquery->save();
}
}
}
$token->usesleft--;
}
$token->save();
if ($quotaexit == false) {
if ($token && trim(strip_tags($thissurvey['email_confirm'])) != "" && $thissurvey['sendconfirmation'] == "Y") {
// if($token->completed == "Y" || $token->completed == $today)
// {
$from = "{$thissurvey['adminname']} <{$thissurvey['adminemail']}>";
$subject = $thissurvey['email_confirm_subj'];
$aReplacementVars = array();
$aReplacementVars["ADMINNAME"] = $thissurvey['admin'];
$aReplacementVars["ADMINEMAIL"] = $thissurvey['adminemail'];
$aReplacementVars['ADMINEMAIL'] = $thissurvey['adminemail'];
//Fill with token info, because user can have his information with anonimity control
$aReplacementVars["FIRSTNAME"] = $token->firstname;
$aReplacementVars["LASTNAME"] = $token->lastname;
$aReplacementVars["TOKEN"] = $token->token;
// added survey url in replacement vars
$surveylink = Yii::app()->createAbsoluteUrl("/survey/index/sid/{$surveyid}", array('lang' => $_SESSION['survey_' . $surveyid]['s_lang'], 'token' => $token->token));
$aReplacementVars['SURVEYURL'] = $surveylink;
$attrfieldnames = getAttributeFieldNames($surveyid);
foreach ($attrfieldnames as $attr_name) {
$aReplacementVars[strtoupper($attr_name)] = $token->{$attr_name};
}
$dateformatdatat = getDateFormatData($thissurvey['surveyls_dateformat']);
$numberformatdatat = getRadixPointData($thissurvey['surveyls_numberformat']);
$redata = array('thissurvey' => $thissurvey);
$subject = templatereplace($subject, $aReplacementVars, $redata, '', false, null, array(), true);
$subject = html_entity_decode($subject, ENT_QUOTES, $emailcharset);
if (getEmailFormat($surveyid) == 'html') {
$ishtml = true;
} else {
$ishtml = false;
}
$message = $thissurvey['email_confirm'];
//$message=ReplaceFields($message, $fieldsarray, true);
$message = templatereplace($message, $aReplacementVars, $redata, '', false, null, array(), true);
if (!$ishtml) {
$message = strip_tags(breakToNewline(html_entity_decode($message, ENT_QUOTES, $emailcharset)));
} else {
$message = html_entity_decode($message, ENT_QUOTES, $emailcharset);
}
//Only send confirmation email if there is a valid email address
$sToAddress = validateEmailAddresses($token->email);
if ($sToAddress) {
$aAttachments = unserialize($thissurvey['attachments']);
$aRelevantAttachments = array();
/*
* Iterate through attachments and check them for relevance.
*/
if (isset($aAttachments['confirmation'])) {
foreach ($aAttachments['confirmation'] as $aAttachment) {
$relevance = $aAttachment['relevance'];
// If the attachment is relevant it will be added to the mail.
//.........这里部分代码省略.........
示例10: action
//.........这里部分代码省略.........
UpdateFieldArray();
// to refresh question titles and question text
}
} else {
throw new CHttpException(404, "The survey in which you are trying to participate does not seem to exist. It may have been deleted or the link you were given is outdated or incorrect.");
}
// Get token
if (!isset($token)) {
$token = $clienttoken;
}
//GET BASIC INFORMATION ABOUT THIS SURVEY
$thissurvey = getSurveyInfo($surveyid, $_SESSION['survey_' . $surveyid]['s_lang']);
$event = new PluginEvent('beforeSurveyPage');
$event->set('surveyId', $surveyid);
App()->getPluginManager()->dispatchEvent($event);
if (!is_null($event->get('template'))) {
$thissurvey['templatedir'] = $event->get('template');
}
//SEE IF SURVEY USES TOKENS
if ($surveyExists == 1 && tableExists('{{tokens_' . $thissurvey['sid'] . '}}')) {
$tokensexist = 1;
} else {
$tokensexist = 0;
unset($_POST['token']);
unset($param['token']);
unset($token);
unset($clienttoken);
}
//SET THE TEMPLATE DIRECTORY
global $oTemplate;
$thistpl = $oTemplate->viewPath;
$timeadjust = Yii::app()->getConfig("timeadjust");
//MAKE SURE SURVEY HASN'T EXPIRED
if ($thissurvey['expiry'] != '' and dateShift(date("Y-m-d H:i:s"), "Y-m-d H:i:s", $timeadjust) > $thissurvey['expiry'] && $thissurvey['active'] != 'N' && !$previewmode) {
$redata = compact(array_keys(get_defined_vars()));
$asMessage = array(gT("Error"), gT("This survey is no longer available."), sprintf(gT("Please contact %s ( %s ) for further assistance."), $thissurvey['adminname'], $thissurvey['adminemail']));
$this->_niceExit($redata, __LINE__, $thissurvey['templatedir'], $asMessage);
}
//MAKE SURE SURVEY IS ALREADY VALID
if ($thissurvey['startdate'] != '' and dateShift(date("Y-m-d H:i:s"), "Y-m-d H:i:s", $timeadjust) < $thissurvey['startdate'] && $thissurvey['active'] != 'N' && !$previewmode) {
$redata = compact(array_keys(get_defined_vars()));
$asMessage = array(gT("Error"), gT("This survey is not yet started."), sprintf(gT("Please contact %s ( %s ) for further assistance."), $thissurvey['adminname'], $thissurvey['adminemail']));
$this->_niceExit($redata, __LINE__, $thissurvey['templatedir'], $asMessage);
}
//CHECK FOR PREVIOUSLY COMPLETED COOKIE
//If cookies are being used, and this survey has been completed, a cookie called "PHPSID[sid]STATUS" will exist (ie: SID6STATUS) and will have a value of "COMPLETE"
$sCookieName = "LS_" . $surveyid . "_STATUS";
if (isset($_COOKIE[$sCookieName]) && $_COOKIE[$sCookieName] == "COMPLETE" && $thissurvey['usecookie'] == "Y" && $tokensexist != 1 && (!isset($param['newtest']) || $param['newtest'] != "Y")) {
$redata = compact(array_keys(get_defined_vars()));
$asMessage = array(gT("Error"), gT("You have already completed this survey."), sprintf(gT("Please contact %s ( %s ) for further assistance."), $thissurvey['adminname'], $thissurvey['adminemail']));
$this->_niceExit($redata, __LINE__, $thissurvey['templatedir'], $asMessage);
}
//LOAD SAVED SURVEY
if (Yii::app()->request->getParam('loadall') == "reload") {
$errormsg = "";
$sLoadName = Yii::app()->request->getParam('loadname');
$sLoadPass = Yii::app()->request->getParam('loadpass');
if (isset($sLoadName) && !$sLoadName) {
$errormsg .= gT("You did not provide a name") . "<br />\n";
}
if (isset($sLoadPass) && !$sLoadPass) {
$errormsg .= gT("You did not provide a password") . "<br />\n";
}
// if security question answer is incorrect
// Not called if scid is set in GET params (when using email save/reload reminder URL)
if (function_exists("ImageCreate") && isCaptchaEnabled('saveandloadscreen', $thissurvey['usecaptcha']) && is_null(Yii::app()->request->getQuery('scid'))) {
示例11: remind_participants
/**
* RPC Routine to send reminder for participants in a survey
* Returns array of results of sending
*
* @access public
* @param string $sSessionKey Auth credentials
* @param int $iSurveyID ID of the survey that participants belong
* @param int $iMinDaysBetween Optional parameter days from last reminder
* @param int $iMaxReminders Optional parameter Maximum reminders count
* @return array Result of the action
*/
public function remind_participants($sSessionKey, $iSurveyID, $iMinDaysBetween = null, $iMaxReminders = null)
{
Yii::app()->loadHelper('admin/token');
if (!$this->_checkSessionKey($sSessionKey)) {
return array('status' => 'Invalid session key');
}
$oSurvey = Survey::model()->findByPk($iSurveyID);
if (!isset($oSurvey)) {
return array('status' => 'Error: Invalid survey ID');
}
if (Permission::model()->hasSurveyPermission($iSurveyID, 'tokens', 'update')) {
$timeadjust = Yii::app()->getConfig("timeadjust");
if (!tableExists("{{tokens_{$iSurveyID}}}")) {
return array('status' => 'Error: No token table');
}
if (getEmailFormat($iSurveyID) == 'html') {
$bHtml = true;
} else {
$bHtml = false;
}
$SQLemailstatuscondition = "emailstatus = 'OK'";
$SQLremindercountcondition = '';
$SQLreminderdelaycondition = '';
$iMaxEmails = (int) Yii::app()->getConfig("maxemails");
if (!is_null($iMinDaysBetween)) {
$compareddate = dateShift(date("Y-m-d H:i:s", time() - 86400 * $iMinDaysBetween), "Y-m-d H:i", $timeadjust);
$SQLreminderdelaycondition = " ((remindersent = 'N' AND sent < '" . $compareddate . "') OR (remindersent < '" . $compareddate . "'))";
}
if (!is_null($iMaxReminders)) {
$SQLremindercountcondition = "remindercount < " . $iMaxReminders;
}
$oTokens = TokenDynamic::model($iSurveyID);
$aAllTokens = $oTokens->findUninvitedIDs(false, 0, false, $SQLemailstatuscondition, $SQLremindercountcondition, $SQLreminderdelaycondition);
$iAllTokensCount = count($aAllTokens);
unset($aAllTokens);
// save some memory before the next query
$aResultTokens = $oTokens->findUninvited(false, $iMaxEmails, false, $SQLemailstatuscondition, $SQLremindercountcondition, $SQLreminderdelaycondition);
if (empty($aResultTokens)) {
return array('status' => 'Error: No candidate tokens');
}
$aResult = emailTokens($iSurveyID, $aResultTokens, 'remind');
$iLeft = $iAllTokensCount - count($aResultTokens);
$aResult['status'] = $iLeft . " left to send";
return $aResult;
} else {
return array('status' => 'No permission');
}
}
示例12: scopes
/**
* Returns this model's scopes
*
* @access public
* @return array
*/
public function scopes()
{
return array('active' => array('condition' => "active = 'Y'"), 'open' => array('condition' => '(startdate <= :now1 OR startdate IS NULL) AND (expires >= :now2 OR expires IS NULL)', 'params' => array(':now1' => dateShift(date("Y-m-d H:i:s"), "Y-m-d H:i:s", Yii::app()->getConfig("timeadjust")), ':now2' => dateShift(date("Y-m-d H:i:s"), "Y-m-d H:i:s", Yii::app()->getConfig("timeadjust")))), 'public' => array('condition' => "listpublic = 'Y'"), 'registration' => array('condition' => "allowregister = 'Y' AND startdate > :now3 AND (expires < :now4 OR expires IS NULL)", 'params' => array(':now3' => dateShift(date("Y-m-d H:i:s"), "Y-m-d H:i:s", Yii::app()->getConfig("timeadjust")), ':now4' => dateShift(date("Y-m-d H:i:s"), "Y-m-d H:i:s", Yii::app()->getConfig("timeadjust")))));
}
示例13: _createDbBackup
/**
* Create a backup of the DataBase
* @return array result of backup
*/
private function _createDbBackup()
{
Yii::app()->loadHelper("admin/backupdb");
$backupDb = new stdClass();
$basefilename = dateShift(date("Y-m-d H:i:s"), "Y-m-d", Yii::app()->getConfig('timeadjust')) . '_' . md5(uniqid(rand(), true));
$sfilename = $this->tempdir . DIRECTORY_SEPARATOR . "backup_db_" . randomChars(20) . "_" . dateShift(date("Y-m-d H:i:s"), "Y-m-d", Yii::app()->getConfig('timeadjust')) . ".sql";
$dfilename = $this->tempdir . DIRECTORY_SEPARATOR . "LimeSurvey_database_backup_" . $basefilename . ".zip";
outputDatabase('', false, $sfilename);
if (is_file($sfilename) && filesize($sfilename)) {
$archive = new PclZip($dfilename);
$v_list = $archive->add(array($sfilename), PCLZIP_OPT_REMOVE_PATH, $this->tempdir, PCLZIP_OPT_ADD_TEMP_FILE_ON);
unlink($sfilename);
if ($v_list == 0) {
$backupDb->result = FALSE;
$backupDb->message = 'db_backup_zip_failed';
} else {
$backupDb->result = TRUE;
$backupDb->message = htmlspecialchars($dfilename);
}
} else {
$backupDb->result = FALSE;
$backupDb->message = htmlspecialchars(db_backup_failed);
}
return $backupDb;
}
示例14: menuMain
protected function menuMain()
{
$title = CHtml::tag('strong', array(), gT('Administration'));
if (Yii::app()->session['loginID']) {
$title .= ' -- ' . gT("Logged in as:");
$text = ' ' . Yii::app()->session['user'] . ' ' . CHtml::image(Yii::app()->getConfig('adminimageurl') . 'profile_edit.png', gT("Edit your personal preferences"));
$title .= CHtml::tag('strong', array(), CHtml::link($text, array('admin/user', 'sa' => 'personalsettings')));
}
$menu['title'] = CHtml::tag('div', array('class' => 'menubar-title-left'), $title);
$menu['role'] = 'main';
$menu['imageUrl'] = App()->getConfig('adminimageurl');
$menu['items']['left'][] = array('href' => array('admin/survey'), 'alt' => gT('Default administration page'), 'image' => 'home.png');
$menu['items']['left'][] = 'separator';
if (Permission::model()->hasGlobalPermission('users', 'read')) {
$menu['items']['left'][] = array('href' => array('admin/user'), 'alt' => gT('Manage survey administrators'), 'image' => 'security.png');
}
$menu['items']['left'][] = $this->userGroups();
$menu['items']['left'][] = $this->globalSettings();
$menu['items']['left'][] = 'separator';
$menu['items']['left'][] = $this->checkIntegrity();
$menu['items']['left'][] = $this->dumpDatabase();
$menu['items']['left'][] = 'separator';
$menu['items']['left'][] = $this->editLabels();
$menu['items']['left'][] = 'separator';
$menu['items']['left'][] = $this->editTemplates();
$menu['items']['left'][] = 'separator';
$menu['items']['left'][] = $this->participantDatabase();
$menu['items']['left'][] = $this->pluginManager();
$surveys = getSurveyList(true);
$tmpList = array();
$timeadjust = getGlobalSetting('timeadjust');
foreach ($surveys as $survey) {
if ($survey['active'] != 'Y') {
$group = gT("Inactive");
$list = 'inactive';
} elseif ($survey['expires'] != '' && $survey['expires'] < dateShift(date("Y-m-d H:i:s"), "Y-m-d H:i:s", $timeadjust)) {
$group = gT("Expired");
$list = 'expired';
} else {
$group = gT("Active");
$list = 'active';
}
$tmpList[$list][] = array('id' => $survey['sid'], 'title' => $survey['surveyls_title'], 'group' => $group);
}
$surveyList = array();
if (array_key_exists('active', $tmpList)) {
$surveyList = array_merge($surveyList, $tmpList['active']);
}
if (array_key_exists('expired', $tmpList)) {
$surveyList = array_merge($surveyList, $tmpList['expired']);
}
if (array_key_exists('inactive', $tmpList)) {
$surveyList = array_merge($surveyList, $tmpList['inactive']);
}
$menu['items']['right'][] = array('title' => gT('Surveys:'), 'type' => 'select', 'name' => 'surveyid', 'route' => 'admin/survey/sa/view', 'param' => 'surveyid', 'empty' => gT('No surveys available.'), 'values' => $surveyList, 'value' => $this->surveyId);
$menu['items']['right'][] = array('href' => array('admin/survey', 'sa' => 'index'), 'alt' => gT('Detailed list of surveys'), 'image' => 'surveylist.png');
$menu['items']['right'][] = $this->createSurvey();
$menu['items']['right'][] = 'separator';
$menu['items']['right'][] = array('href' => array('admin/authentication', 'sa' => 'logout'), 'alt' => gT('Logout'), 'image' => 'logout.png');
$menu['items']['right'][] = array('href' => "http://docs.limesurvey.org", 'alt' => gT('LimeSurvey online manual'), 'image' => 'showhelp.png');
$event = new PluginEvent('afterAdminMenuLoad', $this);
$event->set('menu', $menu);
$result = App()->getPluginManager()->dispatchEvent($event);
$menu = $result->get('menu');
return $menu;
}
示例15: eT
{
document.getElementById("saveoptions").style.display="none";
document.getElementById("closerecord").disabled=false;
}
}
//-->
</script>
<tr>
<td colspan='3' align='center'>
<table><tr><td align='left'>
<input type='checkbox' class='checkboxbtn' name='closerecord' id='closerecord' checked='checked'/><label for='closerecord'><?php
eT("Finalize response submission");
?>
</label></td></tr>
<input type='hidden' name='closedate' value='<?php
echo dateShift(date("Y-m-d H:i:s"), "Y-m-d H:i:s", $yii->getConfig('timeadjust'));
?>
' />
<?php
if ($thissurvey['allowsave'] == "Y") {
?>
<tr><td align='left'><input type='checkbox' class='checkboxbtn' name='save' id='save' onclick='saveshow(this.id)' /><label for='save'><?php
eT("Save for further completion by survey user");
?>
</label>
</td></tr></table>
<div name='saveoptions' id='saveoptions' style='display: none'>
<table align='center' class='outlinetable'>
<tr><td align='right'><?php