本文整理汇总了PHP中hasTemplateManageRights函数的典型用法代码示例。如果您正苦于以下问题:PHP hasTemplateManageRights函数的具体用法?PHP hasTemplateManageRights怎么用?PHP hasTemplateManageRights使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了hasTemplateManageRights函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: if
<option value='A'
<?php if ($esrow['format'] == "A") { ?>
selected='selected'
<?php } ?>
><?php eT("All in one"); ?>
</option>
</select>
</li>
<li>
<label for='template'><?php eT("Template:"); ?></label>
<select id='template' name='template'>
<?php foreach (array_keys(getTemplateList()) as $tname) {
if (Permission::model()->hasGlobalPermission('superadmin','read') || Permission::model()->hasGlobalPermission('templates','read') || hasTemplateManageRights(Yii::app()->session["loginID"], $tname) == 1 || $esrow['template']==htmlspecialchars($tname) ) { ?>
<option value='<?php echo $tname; ?>'
<?php if ($esrow['template'] && htmlspecialchars($tname) == $esrow['template']) { ?>
selected='selected'
<?php } elseif (!$esrow['template'] && $tname == Yii::app()->getConfig('defaulttemplate')) { ?>
selected='selected'
<?php } ?>
><?php echo $tname; ?></option>
<?php }
} ?>
</select>
</li>
<li><label for='preview'><?php eT("Template Preview:"); ?></label>
<img alt='<?php eT("Template preview image"); ?>' name='preview' id='preview' src='<?php echo getTemplateURL($esrow['template']); ?>/preview.png' />
</li>
示例2: alert
$_POST['url'] = "";
}
if (!$_POST['surveyls_title']) {
$databaseoutput .= "<script type=\"text/javascript\">\n<!--\n alert(\"" . $clang->gT("Survey could not be created because it did not have a title", "js") . "\")\n //-->\n</script>\n";
} else {
// Get random ids until one is found that is not used
do {
$surveyid = sRandomChars(5, '123456789');
$isquery = "SELECT sid FROM " . db_table_name('surveys') . " WHERE sid={$surveyid}";
$isresult = db_execute_assoc($isquery);
// Checked
} while ($isresult->RecordCount() > 0);
if (!isset($_POST['template'])) {
$_POST['template'] = 'default';
}
if ($_SESSION['USER_RIGHT_SUPERADMIN'] != 1 && $_SESSION['USER_RIGHT_MANAGE_TEMPLATE'] != 1 && !hasTemplateManageRights($_SESSION['loginID'], $_POST['template'])) {
$_POST['template'] = "default";
}
// insert base language into surveys_language_settings
if ($filterxsshtml) {
require_once "../classes/inputfilter/class.inputfilter_clean.php";
$myFilter = new InputFilter('', '', 1, 1, 1);
$_POST['surveyls_title'] = $myFilter->process($_POST['surveyls_title']);
$_POST['description'] = $myFilter->process($_POST['description']);
$_POST['welcome'] = $myFilter->process($_POST['welcome']);
$_POST['urldescrip'] = $myFilter->process($_POST['urldescrip']);
} else {
$_POST['surveyls_title'] = html_entity_decode($_POST['surveyls_title'], ENT_QUOTES, "UTF-8");
$_POST['description'] = html_entity_decode($_POST['description'], ENT_QUOTES, "UTF-8");
$_POST['welcome'] = html_entity_decode($_POST['welcome'], ENT_QUOTES, "UTF-8");
$_POST['urldescrip'] = html_entity_decode($_POST['urldescrip'], ENT_QUOTES, "UTF-8");
示例3: foreach
><?php
$clang->eT("All in one");
?>
</option>
</select>
</li>
<li><label for='template'><?php
$clang->eT("Template:");
?>
</label>
<select id='template' name='template'>
<?php
foreach (array_keys(getTemplateList()) as $tname) {
if (Permission::model()->hasGlobalPermission('superadmin', 'read') || Permission::model()->hasGlobalPermission('templates', 'read') || hasTemplateManageRights(Yii::app()->session["loginID"], $tname) == 1) {
?>
<option value='<?php
echo $tname;
?>
'
<?php
if ($esrow['template'] && htmlspecialchars($tname) == $esrow['template']) {
?>
selected='selected'
<?php
} elseif (!$esrow['template'] && $tname == "default") {
?>
selected='selected'
<?php
}
示例4: insert
/**
* Saves the new survey after the creation screen is submitted
*
* @param $iSurveyID The survey id to be used for the new survey. If already taken a new random one will be used.
*/
function insert($iSurveyID = null)
{
if (Permission::model()->hasGlobalPermission('surveys', 'create')) {
// Check if survey title was set
if (!$_POST['surveyls_title']) {
Yii::app()->session['flashmessage'] = $clang->gT("Survey could not be created because it did not have a title");
redirect($this->getController()->createUrl('admin'));
return;
}
// Check if template may be used
$sTemplate = $_POST['template'];
if (!$sTemplate || !Permission::model()->hasGlobalPermission('superadmin', 'read') && !Permission::model()->hasGlobalPermission('templates', 'read') && !hasTemplateManageRights(Yii::app()->session['loginID'], $_POST['template'])) {
$sTemplate = "default";
}
Yii::app()->loadHelper("surveytranslator");
// If start date supplied convert it to the right format
$aDateFormatData = getDateFormatData(Yii::app()->session['dateformat']);
$sStartDate = $_POST['startdate'];
if (trim($sStartDate) != '') {
Yii::import('application.libraries.Date_Time_Converter');
$converter = new Date_Time_Converter($sStartDate, $aDateFormatData['phpdate'] . ' H:i:s');
$sStartDate = $converter->convert("Y-m-d H:i:s");
}
// If expiry date supplied convert it to the right format
$sExpiryDate = $_POST['expires'];
if (trim($sExpiryDate) != '') {
Yii::import('application.libraries.Date_Time_Converter');
$converter = new Date_Time_Converter($sExpiryDate, $aDateFormatData['phpdate'] . ' H:i:s');
$sExpiryDate = $converter->convert("Y-m-d H:i:s");
}
$iTokenLength = $_POST['tokenlength'];
//token length has to be at least 5, otherwise set it to default (15)
if ($iTokenLength < 5) {
$iTokenLength = 15;
}
if ($iTokenLength > 36) {
$iTokenLength = 36;
}
// Insert base settings into surveys table
$aInsertData = array('expires' => $sExpiryDate, 'startdate' => $sStartDate, 'template' => $sTemplate, 'owner_id' => Yii::app()->session['loginID'], 'admin' => $_POST['admin'], 'active' => 'N', 'anonymized' => $_POST['anonymized'], 'faxto' => $_POST['faxto'], 'format' => $_POST['format'], 'savetimings' => $_POST['savetimings'], 'language' => $_POST['language'], 'datestamp' => $_POST['datestamp'], 'ipaddr' => $_POST['ipaddr'], 'refurl' => $_POST['refurl'], 'usecookie' => $_POST['usecookie'], 'emailnotificationto' => $_POST['emailnotificationto'], 'allowregister' => $_POST['allowregister'], 'allowsave' => $_POST['allowsave'], 'navigationdelay' => $_POST['navigationdelay'], 'autoredirect' => $_POST['autoredirect'], 'showxquestions' => $_POST['showxquestions'], 'showgroupinfo' => $_POST['showgroupinfo'], 'showqnumcode' => $_POST['showqnumcode'], 'shownoanswer' => $_POST['shownoanswer'], 'showwelcome' => $_POST['showwelcome'], 'allowprev' => $_POST['allowprev'], 'questionindex' => $_POST['questionindex'], 'nokeyboard' => $_POST['nokeyboard'], 'showprogress' => $_POST['showprogress'], 'printanswers' => $_POST['printanswers'], 'listpublic' => $_POST['public'], 'htmlemail' => $_POST['htmlemail'], 'sendconfirmation' => $_POST['sendconfirmation'], 'tokenanswerspersistence' => $_POST['tokenanswerspersistence'], 'alloweditaftercompletion' => $_POST['alloweditaftercompletion'], 'usecaptcha' => $_POST['usecaptcha'], 'publicstatistics' => $_POST['publicstatistics'], 'publicgraphs' => $_POST['publicgraphs'], 'assessments' => $_POST['assessments'], 'emailresponseto' => $_POST['emailresponseto'], 'tokenlength' => $iTokenLength);
$warning = '';
// make sure we only update emails if they are valid
if (Yii::app()->request->getPost('adminemail', '') == '' || validateEmailAddress(Yii::app()->request->getPost('adminemail'))) {
$aInsertData['adminemail'] = Yii::app()->request->getPost('adminemail');
} else {
$aInsertData['adminemail'] = '';
$warning .= $this->getController()->lang->gT("Warning! Notification email was not updated because it was not valid.") . '<br/>';
}
if (Yii::app()->request->getPost('bounce_email', '') == '' || validateEmailAddress(Yii::app()->request->getPost('bounce_email'))) {
$aInsertData['bounce_email'] = Yii::app()->request->getPost('bounce_email');
} else {
$aInsertData['bounce_email'] = '';
$warning .= $this->getController()->lang->gT("Warning! Bounce email was not updated because it was not valid.") . '<br/>';
}
if (!is_null($iSurveyID)) {
$aInsertData['wishSID'] = $iSurveyID;
}
$iNewSurveyid = Survey::model()->insertNewSurvey($aInsertData);
if (!$iNewSurveyid) {
die('Survey could not be created.');
}
// Prepare locale data for surveys_language_settings table
$sTitle = $_POST['surveyls_title'];
$sDescription = $_POST['description'];
$sWelcome = $_POST['welcome'];
$sURLDescription = $_POST['urldescrip'];
if (Yii::app()->getConfig('filterxsshtml')) {
//$p = new CHtmlPurifier();
//$p->options = array('URI.AllowedSchemes'=>array('http' => true, 'https' => true));
//$sTitle=$p->purify($sTitle);
//$sDescription=$p->purify($sDescription);
//$sWelcome=$p->purify($sWelcome);
//$sURLDescription=$p->purify($sURLDescription);
}
$sTitle = html_entity_decode($sTitle, ENT_QUOTES, "UTF-8");
$sDescription = html_entity_decode($sDescription, ENT_QUOTES, "UTF-8");
$sWelcome = html_entity_decode($sWelcome, ENT_QUOTES, "UTF-8");
$sURLDescription = html_entity_decode($sURLDescription, ENT_QUOTES, "UTF-8");
// Fix bug with FCKEditor saving strange BR types
$sTitle = fixCKeditorText($sTitle);
$sDescription = fixCKeditorText($sDescription);
$sWelcome = fixCKeditorText($sWelcome);
// Insert base language into surveys_language_settings table
$aInsertData = array('surveyls_survey_id' => $iNewSurveyid, 'surveyls_title' => $sTitle, 'surveyls_description' => $sDescription, 'surveyls_welcometext' => $sWelcome, 'surveyls_language' => $_POST['language'], 'surveyls_urldescription' => $_POST['urldescrip'], 'surveyls_endtext' => $_POST['endtext'], 'surveyls_url' => $_POST['url'], 'surveyls_dateformat' => (int) $_POST['dateformat'], 'surveyls_numberformat' => (int) $_POST['numberformat']);
$langsettings = new SurveyLanguageSetting();
$langsettings->insertNewSurvey($aInsertData);
Yii::app()->session['flashmessage'] = $warning . $this->getController()->lang->gT("Survey was successfully added.");
// Update survey permissions
Permission::model()->giveAllSurveyPermissions(Yii::app()->session['loginID'], $iNewSurveyid);
$this->getController()->redirect(array('admin/survey/sa/view/surveyid/' . $iNewSurveyid));
}
}
示例5: index
//.........这里部分代码省略.........
$formatdata = getDateFormatData(Yii::app()->session['dateformat']);
$expires = $_POST['expires'];
if (trim($expires) == "") {
$expires = null;
} else {
Yii::app()->loadLibrary('Date_Time_Converter');
$datetimeobj = new date_time_converter($expires, $formatdata['phpdate'] . ' H:i');
//new Date_Time_Converter($expires, $formatdata['phpdate'].' H:i');
$expires = $datetimeobj->convert("Y-m-d H:i:s");
}
$startdate = $_POST['startdate'];
if (trim($startdate) == "") {
$startdate = null;
} else {
Yii::app()->loadLibrary('Date_Time_Converter');
$datetimeobj = new date_time_converter($startdate, $formatdata['phpdate'] . ' H:i');
//new Date_Time_Converter($startdate,$formatdata['phpdate'].' H:i');
$startdate = $datetimeobj->convert("Y-m-d H:i:s");
}
//make sure only numbers are passed within the $_POST variable
$tokenlength = (int) $_POST['tokenlength'];
//token length has to be at least 5, otherwise set it to default (15)
if ($tokenlength < 5) {
$tokenlength = 15;
}
if ($tokenlength > 36) {
$tokenlength = 36;
}
cleanLanguagesFromSurvey($iSurveyID, Yii::app()->request->getPost('languageids'));
fixLanguageConsistency($iSurveyID, Yii::app()->request->getPost('languageids'));
$Survey = Survey::model()->findByPk($iSurveyID);
// Validate template : accepted: user have rigth to read template OR template are not updated : else set to the default from config
$template = Yii::app()->request->getPost('template');
if (!Permission::model()->hasGlobalPermission('superadmin', 'read') && !Permission::model()->hasGlobalPermission('templates', 'read') && !hasTemplateManageRights(Yii::app()->session['loginID'], $template) && $template != $Survey->template) {
$template = Yii::app()->getConfig('defaulttemplate');
}
$aURLParams = json_decode(Yii::app()->request->getPost('allurlparams'), true);
SurveyURLParameter::model()->deleteAllByAttributes(array('sid' => $iSurveyID));
if (isset($aURLParams)) {
foreach ($aURLParams as $aURLParam) {
$aURLParam['parameter'] = trim($aURLParam['parameter']);
if ($aURLParam['parameter'] == '' || !preg_match('/^[a-zA-Z_][a-zA-Z0-9_]*$/', $aURLParam['parameter']) || $aURLParam['parameter'] == 'sid' || $aURLParam['parameter'] == 'newtest' || $aURLParam['parameter'] == 'token' || $aURLParam['parameter'] == 'lang') {
continue;
// this parameter name seems to be invalid - just ignore it
}
unset($aURLParam['act']);
unset($aURLParam['title']);
unset($aURLParam['id']);
if ($aURLParam['targetqid'] == '') {
$aURLParam['targetqid'] = NULL;
}
if ($aURLParam['targetsqid'] == '') {
$aURLParam['targetsqid'] = NULL;
}
$aURLParam['sid'] = $iSurveyID;
$param = new SurveyURLParameter();
foreach ($aURLParam as $k => $v) {
$param->{$k} = $v;
}
$param->save();
}
}
$updatearray = array('admin' => Yii::app()->request->getPost('admin'), 'expires' => $expires, 'startdate' => $startdate, 'anonymized' => Yii::app()->request->getPost('anonymized'), 'faxto' => Yii::app()->request->getPost('faxto'), 'format' => Yii::app()->request->getPost('format'), 'savetimings' => Yii::app()->request->getPost('savetimings'), 'template' => $template, 'assessments' => Yii::app()->request->getPost('assessments'), 'language' => Yii::app()->request->getPost('language'), 'additional_languages' => Yii::app()->request->getPost('languageids'), 'datestamp' => Yii::app()->request->getPost('datestamp'), 'ipaddr' => Yii::app()->request->getPost('ipaddr'), 'refurl' => Yii::app()->request->getPost('refurl'), 'publicgraphs' => Yii::app()->request->getPost('publicgraphs'), 'usecookie' => Yii::app()->request->getPost('usecookie'), 'allowregister' => Yii::app()->request->getPost('allowregister'), 'allowsave' => Yii::app()->request->getPost('allowsave'), 'navigationdelay' => Yii::app()->request->getPost('navigationdelay'), 'printanswers' => Yii::app()->request->getPost('printanswers'), 'publicstatistics' => Yii::app()->request->getPost('publicstatistics'), 'autoredirect' => Yii::app()->request->getPost('autoredirect'), 'showxquestions' => Yii::app()->request->getPost('showxquestions'), 'showgroupinfo' => Yii::app()->request->getPost('showgroupinfo'), 'showqnumcode' => Yii::app()->request->getPost('showqnumcode'), 'shownoanswer' => Yii::app()->request->getPost('shownoanswer'), 'showwelcome' => Yii::app()->request->getPost('showwelcome'), 'allowprev' => Yii::app()->request->getPost('allowprev'), 'questionindex' => Yii::app()->request->getPost('questionindex'), 'nokeyboard' => Yii::app()->request->getPost('nokeyboard'), 'showprogress' => Yii::app()->request->getPost('showprogress'), 'listpublic' => Yii::app()->request->getPost('public'), 'htmlemail' => Yii::app()->request->getPost('htmlemail'), 'sendconfirmation' => Yii::app()->request->getPost('sendconfirmation'), 'tokenanswerspersistence' => Yii::app()->request->getPost('tokenanswerspersistence'), 'alloweditaftercompletion' => Yii::app()->request->getPost('alloweditaftercompletion'), 'usecaptcha' => Yii::app()->request->getPost('usecaptcha'), 'emailresponseto' => trim(Yii::app()->request->getPost('emailresponseto')), 'emailnotificationto' => trim(Yii::app()->request->getPost('emailnotificationto')), 'googleanalyticsapikey' => trim(Yii::app()->request->getPost('googleanalyticsapikey')), 'googleanalyticsstyle' => trim(Yii::app()->request->getPost('googleanalyticsstyle')), 'tokenlength' => $tokenlength);
$warning = '';
// make sure we only update admin email if it is valid
if (Yii::app()->request->getPost('adminemail', '') == '' || validateEmailAddress(Yii::app()->request->getPost('adminemail'))) {
示例6: validate_templatedir
if ($esrow['format'] == "G") {
$editsurvey .= " selected='selected'";
}
$editsurvey .= ">" . $clang->gT("Group by Group") . "</option>\n" . "<option value='A'";
if ($esrow['format'] == "A") {
$editsurvey .= " selected='selected'";
}
$editsurvey .= ">" . $clang->gT("All in one") . "</option>\n" . "</select>\n" . "</li>\n";
//TEMPLATES
if (!$esrow['template']) {
$esrow['template'] = $defaulttemplate;
}
$esrow['template'] = validate_templatedir($esrow['template']);
$editsurvey .= "<li><label for='template'>" . $clang->gT("Template:") . "</label>\n" . "<select id='template' name='template'>\n";
foreach (array_keys(gettemplatelist()) as $tname) {
if ($_SESSION['USER_RIGHT_SUPERADMIN'] == 1 || $_SESSION['USER_RIGHT_MANAGE_TEMPLATE'] == 1 || hasTemplateManageRights($_SESSION["loginID"], $tname) == 1) {
$editsurvey .= "<option value='{$tname}'";
if ($esrow['template'] && htmlspecialchars($tname) == $esrow['template']) {
$editsurvey .= " selected='selected'";
}
$editsurvey .= ">{$tname}</option>\n";
}
}
$editsurvey .= "</select>\n" . "</li>\n";
$editsurvey .= "<li><label for='preview'>" . $clang->gT("Template Preview:") . "</label>\n" . "<img alt='" . $clang->gT("Template preview image") . "' id='preview' src='" . sGetTemplateURL($esrow['template']) . "/preview.png' />\n" . "</li>\n";
//SHOW WELCOMESCRN
$editsurvey .= "<li><label for='showwelcome'>" . $clang->gT("Show welcome screen?") . "</label>\n" . "<select id='showwelcome' name='showwelcome'>\n" . "<option value='Y'";
if (!$esrow['showwelcome'] || $esrow['showwelcome'] == "Y") {
$editsurvey .= " selected='selected'";
}
$editsurvey .= ">" . $clang->gT("Yes") . "</option>\n" . "<option value='N'";
示例7: index
//.........这里部分代码省略.........
}
}
if (($action == "updatesurveysettingsandeditlocalesettings" || $action == "updatesurveysettings") && hasSurveyPermission($surveyid, 'surveysettings', 'update')) {
Yii::app()->loadHelper('surveytranslator');
Yii::app()->loadHelper('database');
$formatdata = getDateFormatData(Yii::app()->session['dateformat']);
$expires = $_POST['expires'];
if (trim($expires) == "") {
$expires = null;
} else {
Yii::app()->loadLibrary('Date_Time_Converter');
$datetimeobj = new date_time_converter($expires, $formatdata['phpdate'] . ' H:i');
//new Date_Time_Converter($expires, $formatdata['phpdate'].' H:i');
$expires = $datetimeobj->convert("Y-m-d H:i:s");
}
$startdate = $_POST['startdate'];
if (trim($startdate) == "") {
$startdate = null;
} else {
Yii::app()->loadLibrary('Date_Time_Converter');
$datetimeobj = new date_time_converter($startdate, $formatdata['phpdate'] . ' H:i');
//new Date_Time_Converter($startdate,$formatdata['phpdate'].' H:i');
$startdate = $datetimeobj->convert("Y-m-d H:i:s");
}
//make sure only numbers are passed within the $_POST variable
$tokenlength = (int) $_POST['tokenlength'];
//token length has to be at least 5, otherwise set it to default (15)
if ($tokenlength < 5) {
$tokenlength = 15;
}
cleanLanguagesFromSurvey($surveyid, Yii::app()->request->getPost('languageids'));
fixLanguageConsistency($surveyid, Yii::app()->request->getPost('languageids'));
$template = Yii::app()->request->getPost('template');
if (Yii::app()->session['USER_RIGHT_SUPERADMIN'] != 1 && Yii::app()->session['USER_RIGHT_MANAGE_TEMPLATE'] != 1 && !hasTemplateManageRights(Yii::app()->session['loginID'], $template)) {
$template = "default";
}
$aURLParams = json_decode(Yii::app()->request->getPost('allurlparams'), true);
Survey_url_parameters::model()->deleteAllByAttributes(array('sid' => $surveyid));
foreach ($aURLParams as $aURLParam) {
$aURLParam['parameter'] = trim($aURLParam['parameter']);
if ($aURLParam['parameter'] == '' || !preg_match('/^[a-zA-Z_][a-zA-Z0-9_]*$/', $aURLParam['parameter']) || $aURLParam['parameter'] == 'sid' || $aURLParam['parameter'] == 'newtest' || $aURLParam['parameter'] == 'token' || $aURLParam['parameter'] == 'lang') {
continue;
// this parameter name seems to be invalid - just ignore it
}
unset($aURLParam['act']);
unset($aURLParam['title']);
unset($aURLParam['id']);
if ($aURLParam['targetqid'] == '') {
$aURLParam['targetqid'] = NULL;
}
if ($aURLParam['targetsqid'] == '') {
$aURLParam['targetsqid'] = NULL;
}
$aURLParam['sid'] = $surveyid;
$param = new Survey_url_parameters();
foreach ($aURLParam as $k => $v) {
$param->{$k} = $v;
}
$param->save();
}
$updatearray = array('admin' => Yii::app()->request->getPost('admin'), 'expires' => $expires, 'adminemail' => Yii::app()->request->getPost('adminemail'), 'startdate' => $startdate, 'bounce_email' => Yii::app()->request->getPost('bounce_email'), 'anonymized' => Yii::app()->request->getPost('anonymized'), 'faxto' => Yii::app()->request->getPost('faxto'), 'format' => Yii::app()->request->getPost('format'), 'savetimings' => Yii::app()->request->getPost('savetimings'), 'template' => $template, 'assessments' => Yii::app()->request->getPost('assessments'), 'language' => Yii::app()->request->getPost('language'), 'additional_languages' => Yii::app()->request->getPost('languageids'), 'datestamp' => Yii::app()->request->getPost('datestamp'), 'ipaddr' => Yii::app()->request->getPost('ipaddr'), 'refurl' => Yii::app()->request->getPost('refurl'), 'publicgraphs' => Yii::app()->request->getPost('publicgraphs'), 'usecookie' => Yii::app()->request->getPost('usecookie'), 'allowregister' => Yii::app()->request->getPost('allowregister'), 'allowsave' => Yii::app()->request->getPost('allowsave'), 'navigationdelay' => Yii::app()->request->getPost('navigationdelay'), 'printanswers' => Yii::app()->request->getPost('printanswers'), 'publicstatistics' => Yii::app()->request->getPost('publicstatistics'), 'autoredirect' => Yii::app()->request->getPost('autoredirect'), 'showxquestions' => Yii::app()->request->getPost('showxquestions'), 'showgroupinfo' => Yii::app()->request->getPost('showgroupinfo'), 'showqnumcode' => Yii::app()->request->getPost('showqnumcode'), 'shownoanswer' => Yii::app()->request->getPost('shownoanswer'), 'showwelcome' => Yii::app()->request->getPost('showwelcome'), 'allowprev' => Yii::app()->request->getPost('allowprev'), 'allowjumps' => Yii::app()->request->getPost('allowjumps'), 'nokeyboard' => Yii::app()->request->getPost('nokeyboard'), 'showprogress' => Yii::app()->request->getPost('showprogress'), 'listpublic' => Yii::app()->request->getPost('public'), 'htmlemail' => Yii::app()->request->getPost('htmlemail'), 'sendconfirmation' => Yii::app()->request->getPost('sendconfirmation'), 'tokenanswerspersistence' => Yii::app()->request->getPost('tokenanswerspersistence'), 'alloweditaftercompletion' => Yii::app()->request->getPost('alloweditaftercompletion'), 'usecaptcha' => Yii::app()->request->getPost('usecaptcha'), 'emailresponseto' => trim(Yii::app()->request->getPost('emailresponseto')), 'emailnotificationto' => trim(Yii::app()->request->getPost('emailnotificationto')), 'googleanalyticsapikey' => trim(Yii::app()->request->getPost('googleanalyticsapikey')), 'googleanalyticsstyle' => trim(Yii::app()->request->getPost('googleanalyticsstyle')), 'tokenlength' => $tokenlength);
// use model
$Survey = Survey::model()->findByPk($surveyid);
foreach ($updatearray as $k => $v) {
$Survey->{$k} = $v;
}
示例8: insert
/**
* Saves the new survey after the creation screen is submitted
*
* @param $iSurveyID The survey id to be used for the new survey. If already taken a new random one will be used.
*/
function insert($iSurveyID = null)
{
if (Yii::app()->session['USER_RIGHT_CREATE_SURVEY']) {
// Check if survey title was set
if (!$_POST['surveyls_title']) {
Yii::app()->session['flashmessage'] = $clang->gT("Survey could not be created because it did not have a title");
redirect($this->getController()->createUrl('admin'));
return;
}
// Check if template may be used
$sTemplate = $_POST['template'];
if (!$sTemplate || Yii::app()->session['USER_RIGHT_SUPERADMIN'] != 1 && Yii::app()->session['USER_RIGHT_MANAGE_TEMPLATE'] != 1 && !hasTemplateManageRights(Yii::app()->session['loginID'], $_POST['template'])) {
$sTemplate = "default";
}
Yii::app()->loadHelper("surveytranslator");
// If start date supplied convert it to the right format
$aDateFormatData = getDateFormatData(Yii::app()->session['dateformat']);
$sStartDate = $_POST['startdate'];
if (trim($sStartDate) != '') {
Yii::import('application.libraries.Date_Time_Converter');
$converter = new Date_Time_Converter($sStartDate, $aDateFormatData['phpdate'] . ' H:i:s');
$sStartDate = $converter->convert("Y-m-d H:i:s");
}
// If expiry date supplied convert it to the right format
$sExpiryDate = $_POST['expires'];
if (trim($sExpiryDate) != '') {
Yii::import('application.libraries.Date_Time_Converter');
$converter = new Date_Time_Converter($sExpiryDate, $aDateFormatData['phpdate'] . ' H:i:s');
$sExpiryDate = $converter->convert("Y-m-d H:i:s");
}
// Insert base settings into surveys table
$aInsertData = array('expires' => $sExpiryDate, 'startdate' => $sStartDate, 'template' => $sTemplate, 'owner_id' => Yii::app()->session['loginID'], 'admin' => $_POST['admin'], 'active' => 'N', 'adminemail' => $_POST['adminemail'], 'bounce_email' => $_POST['bounce_email'], 'anonymized' => $_POST['anonymized'], 'faxto' => $_POST['faxto'], 'format' => $_POST['format'], 'savetimings' => $_POST['savetimings'], 'language' => $_POST['language'], 'datestamp' => $_POST['datestamp'], 'ipaddr' => $_POST['ipaddr'], 'refurl' => $_POST['refurl'], 'usecookie' => $_POST['usecookie'], 'emailnotificationto' => $_POST['emailnotificationto'], 'allowregister' => $_POST['allowregister'], 'allowsave' => $_POST['allowsave'], 'navigationdelay' => $_POST['navigationdelay'], 'autoredirect' => $_POST['autoredirect'], 'showxquestions' => $_POST['showxquestions'], 'showgroupinfo' => $_POST['showgroupinfo'], 'showqnumcode' => $_POST['showqnumcode'], 'shownoanswer' => $_POST['shownoanswer'], 'showwelcome' => $_POST['showwelcome'], 'allowprev' => $_POST['allowprev'], 'allowjumps' => $_POST['allowjumps'], 'nokeyboard' => $_POST['nokeyboard'], 'showprogress' => $_POST['showprogress'], 'printanswers' => $_POST['printanswers'], 'listpublic' => $_POST['public'], 'htmlemail' => $_POST['htmlemail'], 'sendconfirmation' => $_POST['sendconfirmation'], 'tokenanswerspersistence' => $_POST['tokenanswerspersistence'], 'alloweditaftercompletion' => $_POST['alloweditaftercompletion'], 'usecaptcha' => $_POST['usecaptcha'], 'publicstatistics' => $_POST['publicstatistics'], 'publicgraphs' => $_POST['publicgraphs'], 'assessments' => $_POST['assessments'], 'emailresponseto' => $_POST['emailresponseto'], 'tokenlength' => $_POST['tokenlength']);
if (!is_null($iSurveyID)) {
$aInsertData['wishSID'] = $iSurveyID;
}
$iNewSurveyid = Survey::model()->insertNewSurvey($aInsertData);
if (!$iNewSurveyid) {
die('Survey could not be created.');
}
// Prepare locale data for surveys_language_settings table
$sTitle = $_POST['surveyls_title'];
$sDescription = $_POST['description'];
$sWelcome = $_POST['welcome'];
$sURLDescription = $_POST['urldescrip'];
if (Yii::app()->getConfig('filterxsshtml')) {
//$p = new CHtmlPurifier();
//$p->options = array('URI.AllowedSchemes'=>array('http' => true, 'https' => true));
//$sTitle=$p->purify($sTitle);
//$sDescription=$p->purify($sDescription);
//$sWelcome=$p->purify($sWelcome);
//$sURLDescription=$p->purify($sURLDescription);
}
$sTitle = html_entity_decode($sTitle, ENT_QUOTES, "UTF-8");
$sDescription = html_entity_decode($sDescription, ENT_QUOTES, "UTF-8");
$sWelcome = html_entity_decode($sWelcome, ENT_QUOTES, "UTF-8");
$sURLDescription = html_entity_decode($sURLDescription, ENT_QUOTES, "UTF-8");
// Fix bug with FCKEditor saving strange BR types
$sTitle = fixCKeditorText($sTitle);
$sDescription = fixCKeditorText($sDescription);
$sWelcome = fixCKeditorText($sWelcome);
// Insert base language into surveys_language_settings table
$aInsertData = array('surveyls_survey_id' => $iNewSurveyid, 'surveyls_title' => $sTitle, 'surveyls_description' => $sDescription, 'surveyls_welcometext' => $sWelcome, 'surveyls_language' => $_POST['language'], 'surveyls_urldescription' => $_POST['urldescrip'], 'surveyls_endtext' => $_POST['endtext'], 'surveyls_url' => $_POST['url'], 'surveyls_dateformat' => (int) $_POST['dateformat'], 'surveyls_numberformat' => (int) $_POST['numberformat']);
$langsettings = new Surveys_languagesettings();
$langsettings->insertNewSurvey($aInsertData);
Yii::app()->session['flashmessage'] = $this->getController()->lang->gT("Survey was successfully added.");
// Update survey permissions
Survey_permissions::model()->giveAllSurveyPermissions(Yii::app()->session['loginID'], $iNewSurveyid);
$this->getController()->redirect($this->getController()->createUrl('admin/survey/view/surveyid/' . $iNewSurveyid));
}
}
示例9: foreach
><?php
$clang->eT("All in one");
?>
</option>
</select>
</li>
<li><label for='template'><?php
$clang->eT("Template:");
?>
</label>
<select id='template' name='template'>
<?php
foreach (array_keys(getTemplateList()) as $tname) {
if (Yii::app()->session['USER_RIGHT_SUPERADMIN'] == 1 || Yii::app()->session['USER_RIGHT_MANAGE_TEMPLATE'] == 1 || hasTemplateManageRights(Yii::app()->session["loginID"], $tname) == 1) {
?>
<option value='<?php
echo $tname;
?>
'
<?php
if ($esrow['template'] && htmlspecialchars($tname) == $esrow['template']) {
?>
selected='selected'
<?php
} elseif (!$esrow['template'] && $tname == "default") {
?>
selected='selected'
<?php
}
示例10: foreach
?>
<?php
}
?>
</div>
</div>
<div class="row">
<div class="col-sm-12" id="jcarousel-wrapper-container"> <!-- width defined in css -->
<div class="jcarousel-wrapper" >
<div class="jcarousel">
<ul >
<?php
foreach ($templates as $key => $template) {
?>
<?php
if (Permission::model()->hasGlobalPermission('superadmin', 'read') || Permission::model()->hasGlobalPermission('templates', 'read') || hasTemplateManageRights(Yii::app()->session["loginID"], $key) == 1 || $surveyinfo['template'] == htmlspecialchars($key)) {
?>
<li class="template-miniature <?php
if ($key == $surveyinfo['template']) {
echo ' active';
}
?>
" data-big="#template-big-<?php
echo $key;
?>
">
<img src="<?php
echo $template['preview'];
?>
" alt="<?php
echo $key;