public function run() { App()->loadHelper('surveytranslator'); $aData['issuperadmin'] = false; if (Permission::model()->hasGlobalPermission('superadmin', 'read')) { $aData['issuperadmin'] = true; } // We get the last survey visited by user $setting_entry = 'last_survey_' . Yii::app()->user->getId(); $lastsurvey = getGlobalSetting($setting_entry); $survey = Survey::model()->findByPk($lastsurvey); if ($lastsurvey != null && $survey) { $aData['showLastSurvey'] = true; $iSurveyID = $lastsurvey; $surveyinfo = $survey->surveyinfo; $aData['surveyTitle'] = $surveyinfo['surveyls_title'] . "(" . gT("ID") . ":" . $iSurveyID . ")"; $aData['surveyUrl'] = $this->getController()->createUrl("admin/survey/sa/view/surveyid/{$iSurveyID}"); } else { $aData['showLastSurvey'] = false; } // We get the last question visited by user $setting_entry = 'last_question_' . Yii::app()->user->getId(); $lastquestion = getGlobalSetting($setting_entry); // the question group of this question $setting_entry = 'last_question_gid_' . Yii::app()->user->getId(); $lastquestiongroup = getGlobalSetting($setting_entry); // the sid of this question : last_question_sid_1 $setting_entry = 'last_question_sid_' . Yii::app()->user->getId(); $lastquestionsid = getGlobalSetting($setting_entry); $survey = Survey::model()->findByPk($lastquestionsid); if ($lastquestion && $lastquestiongroup && $survey) { $baselang = $survey->language; $aData['showLastQuestion'] = true; $qid = $lastquestion; $gid = $lastquestiongroup; $sid = $lastquestionsid; $qrrow = Question::model()->findByAttributes(array('qid' => $qid, 'gid' => $gid, 'sid' => $sid, 'language' => $baselang)); if ($qrrow) { $aData['last_question_name'] = $qrrow['title']; if ($qrrow['question']) { $aData['last_question_name'] .= ' : ' . $qrrow['question']; } $aData['last_question_link'] = $this->getController()->createUrl("admin/questions/sa/view/surveyid/{$sid}/gid/{$gid}/qid/{$qid}"); } else { $aData['showLastQuestion'] = false; } } else { $aData['showLastQuestion'] = false; } $aData['countSurveyList'] = count(getSurveyList(true)); // We get the home page display setting $aData['bShowSurveyList'] = getGlobalSetting('show_survey_list') == "show"; $aData['bShowSurveyListSearch'] = getGlobalSetting('show_survey_list_search') == "show"; $aData['bShowLogo'] = getGlobalSetting('show_logo') == "show"; $aData['oSurveySearch'] = new Survey('search'); $aData['bShowLastSurveyAndQuestion'] = getGlobalSetting('show_last_survey_and_question') == "show"; $aData['iBoxesByRow'] = (int) getGlobalSetting('boxes_by_row'); $aData['sBoxesOffSet'] = (string) getGlobalSetting('boxes_offset'); $this->_renderWrappedTemplate('super', 'welcome', $aData); }
public function run() { if (Yii::app()->session['just_logged_in']) { $aViewUrls = array('message' => array('title' => gT("Logged in"), 'message' => Yii::app()->session['loginsummary'])); unset(Yii::app()->session['just_logged_in'], Yii::app()->session['loginsummary']); $this->_renderWrappedTemplate('super', $aViewUrls); } elseif (count(getSurveyList(true)) == 0) { $this->_renderWrappedTemplate('super', 'firststeps'); } else { $this->getController()->redirect(array('admin/survey/sa/index')); } }
/** * Loads list of surveys and it's few quick properties. * * @access public * @return void */ public function index() { App()->getClientScript()->registerPackage('jqgrid'); if (count(getSurveyList(true)) == 0) { $this->_renderWrappedTemplate('super', 'firststeps'); } else { App()->getClientScript()->registerScriptFile(Yii::app()->getConfig('adminscripts') . "listsurvey.js"); Yii::app()->loadHelper('surveytranslator'); $aData['issuperadmin'] = false; if (Permission::model()->hasGlobalPermission('superadmin', 'read')) { $aData['issuperadmin'] = true; } $this->_renderWrappedTemplate('survey', 'listSurveys_view', $aData); } }
public function run() { App()->loadHelper('surveytranslator'); App()->getClientScript()->registerPackage('panel-clickable'); App()->getClientScript()->registerPackage('panels-animation'); $aData['issuperadmin'] = false; if (Permission::model()->hasGlobalPermission('superadmin', 'read')) { $aData['issuperadmin'] = true; } // We get the last survey visited by user $setting_entry = 'last_survey_' . Yii::app()->user->getId(); $lastsurvey = getGlobalSetting($setting_entry); if ($lastsurvey != null) { $aData['showLastSurvey'] = true; $iSurveyID = $lastsurvey; $surveyinfo = Survey::model()->findByPk($iSurveyID)->surveyinfo; $aData['surveyTitle'] = $surveyinfo['surveyls_title'] . "(" . gT("ID") . ":" . $iSurveyID . ")"; $aData['surveyUrl'] = $this->getController()->createUrl("admin/survey/sa/view/surveyid/{$iSurveyID}"); } else { $aData['showLastSurvey'] = false; } // We get the last question visited by user $setting_entry = 'last_question_' . Yii::app()->user->getId(); $lastquestion = getGlobalSetting($setting_entry); // the question group of this question $setting_entry = 'last_question_gid_' . Yii::app()->user->getId(); $lastquestiongroup = getGlobalSetting($setting_entry); // the sid of this question : last_question_sid_1 $setting_entry = 'last_question_sid_' . Yii::app()->user->getId(); $lastquestionsid = getGlobalSetting($setting_entry); if ($lastquestion != null && $lastquestiongroup != null) { $baselang = Survey::model()->findByPk($iSurveyID)->language; $aData['showLastQuestion'] = true; $qid = $lastquestion; $gid = $lastquestiongroup; $sid = $lastquestionsid; $qrrow = Question::model()->findByAttributes(array('qid' => $qid, 'gid' => $gid, 'sid' => $sid, 'language' => $baselang)); $aData['last_question_name'] = $qrrow['title']; if ($qrrow['question']) { $aData['last_question_name'] .= ' : ' . $qrrow['question']; } $aData['last_question_link'] = $this->getController()->createUrl("admin/questions/sa/view/surveyid/{$iSurveyID}/gid/{$gid}/qid/{$qid}"); } else { $aData['showLastQuestion'] = false; } $aData['countSurveyList'] = count(getSurveyList(true)); $this->_renderWrappedTemplate('super', 'welcome', $aData); }
public function run() { $clang = Yii::app()->lang; //tarak // $upara = Yii::app()->getRequest()->getQuery('setup'); // if ($upara == 'database') { // include 'setup' . EXT; // $objSetup = new setupDB(); //creating the object will execute the process // exit; // } //end if (Yii::app()->session['just_logged_in']) { $aViewUrls = array('message' => array('title' => $clang->gT("Logged in"), 'message' => Yii::app()->session['loginsummary'])); unset(Yii::app()->session['just_logged_in'], Yii::app()->session['loginsummary']); $this->_renderWrappedTemplate('super', $aViewUrls); } elseif (count(getSurveyList(true)) == 0) { $this->_renderWrappedTemplate('super', 'firststeps'); } else { $this->getController()->redirect(array('admin/survey/sa/index')); } }
/** * Loads list of surveys and it's few quick properties. * * @access public * @return void */ public function index() { if (count(getSurveyList(true)) == 0) { $this->_renderWrappedTemplate('super', 'firststeps'); } else { $this->getController()->_js_admin_includes(Yii::app()->getConfig('generalscripts') . "jquery/jqGrid/js/i18n/grid.locale-en.js"); $this->getController()->_js_admin_includes(Yii::app()->getConfig('generalscripts') . "jquery/jqGrid/js/jquery.jqGrid.min.js"); $this->getController()->_js_admin_includes(Yii::app()->getConfig('generalscripts') . "jquery/jquery.coookie.js"); $this->getController()->_js_admin_includes(Yii::app()->getConfig('adminscripts') . "listsurvey.js"); $this->getController()->_css_admin_includes(Yii::app()->getConfig('publicstyleurl') . 'jquery.multiselect.css'); $this->getController()->_css_admin_includes(Yii::app()->getConfig('publicstyleurl') . 'jquery.multiselect.filter.css'); $this->getController()->_css_admin_includes(Yii::app()->getConfig('adminstyleurl') . "displayParticipants.css"); $this->getController()->_css_admin_includes(Yii::app()->getConfig('generalscripts') . "jquery/jqGrid/css/ui.jqgrid.css"); $this->getController()->_css_admin_includes(Yii::app()->getConfig('generalscripts') . "jquery/jqGrid/css/jquery.ui.datepicker.css"); Yii::app()->loadHelper('surveytranslator'); $aData['issuperadmin'] = false; if (Yii::app()->session['USER_RIGHT_SUPERADMIN'] == 1) { $aData['issuperadmin'] = true; } $this->_renderWrappedTemplate('survey', 'listSurveys_view', $aData); } }
' height='<?php echo $iconsize; ?> '/></a> <?php } ?> </div> <div class='menubar-right'> <label for='surveylist'><?php $clang->eT("Surveys:"); ?> </label> <select id='surveylist' name='surveylist' onchange="window.open(this.options[this.selectedIndex].value,'_top')"> <?php echo getSurveyList(false, false, $surveyid); ?> </select> <a href="<?php echo $this->createUrl("admin/survey/sa/index"); ?> "> <img src='<?php echo $sImageURL; ?> surveylist.png' alt='<?php $clang->eT("Detailed list of surveys"); ?> ' /> </a>
<?php if(Permission::model()->hasGlobalPermission('participantpanel','read')) { ?> <a href="<?php echo $this->createUrl("admin/participants/sa/index"); ?>" > <img src='<?php echo $sImageURL;?>cpdb.png' alt='<?php $clang->eT("Central participant database/panel");?>' width='<?php echo $iconsize;?>' height='<?php echo $iconsize;?>'/></a> <?php } if(Permission::model()->hasGlobalPermission('superadmin','read')) { ?> <a href="<?php echo $this->createUrl("plugins/"); ?>" > <img src='<?php echo $sImageURL;?>plugin.png' alt='<?php $clang->eT("Plugin manager");?>' width='<?php echo $iconsize;?>' height='<?php echo $iconsize;?>'/></a> <?php }?> </div> <div class='menubar-right'> <label for='surveylist'><?php $clang->eT("Surveys:");?></label> <select id='surveylist' name='surveylist' onchange="if (this.options[this.selectedIndex].value!='') {window.open('<?php echo $this->createUrl("/admin/survey/sa/view/surveyid/"); ?>/'+this.options[this.selectedIndex].value,'_top')} else {window.open('<?php echo $this->createUrl("/admin/survey/sa/index/");?>','_top')}"> <?php echo getSurveyList(false, $surveyid); ?> </select> <a href="<?php echo $this->createUrl("admin/survey/sa/index"); ?>"> <img src='<?php echo $sImageURL;?>surveylist.png' alt='<?php $clang->eT("Detailed list of surveys");?>' /> </a> <?php if (Permission::model()->hasGlobalPermission('surveys','create')) { ?> <a href="<?php echo $this->createUrl("admin/survey/sa/newsurvey"); ?>"> <img src='<?php echo $sImageURL;?>add.png' alt='<?php $clang->eT("Create, import, or copy a survey");?>' /></a> <?php } ?> <img id='separator2' src='<?php echo $sImageURL;?>separator.gif' class='separator' alt='' />
<div id='copy'> <?php echo CHtml::form(array('admin/survey/sa/copy'), 'post', array('id' => 'copysurveyform', 'name' => 'copysurveyform', 'class' => 'form30')); ?> <ul> <li><label for='copysurveylist'><?php $clang->eT("Select survey to copy:"); ?> </label> <select id='copysurveylist' name='copysurveylist' required="required"> <?php echo getSurveyList(false); ?> </select> <span class='annotation'><?php echo $clang->gT("Required"); ?> </span></li> <li><label for='copysurveyname'><?php echo $clang->gT("New survey title:"); ?> </label> <input type='text' id='copysurveyname' size='82' maxlength='200' name='copysurveyname' value='' required="required" /> <span class='annotation'><?php echo $clang->gT("Required"); ?> </span></li> <li><label for='copysurveytranslinksfields'><?php echo $clang->gT("Convert resource links and INSERTANS fields?"); ?> </label> <input id='copysurveytranslinksfields' name="copysurveytranslinksfields" type="checkbox" checked='checked'/></li>
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; }
<?php if (count($_GET) > 0) { foreach ($_GET as $key => $val) { if ($key == 'sid') { $val = $val . '|N'; // hack to pretend this is not an assessment } $_REQUEST[$key] = $val; } $_REQUEST['LEM_PRETTY_PRINT_ALL_SYNTAX'] = 'Y'; } Yii::app()->loadHelper('frontend'); if (empty($_REQUEST['sid'])) { $surveyList = getSurveyList(); $sFormTag = CHtml::form(array('admin/expressions/sa/survey_logic_file'), 'post'); $form = <<<EOD {$sFormTag} <h3>Generate a logic file for the survey</h3> <table border='1'> <tr><th>Parameter</th><th>Value</th></tr> <tr><td>Survey ID (SID)</td> <td><select name='sid' id='sid'> {$surveyList} </select></td></tr> <tr><td>Debug Log Level</td> <td> Specify which debugging features to use <ul> <li><input type='checkbox' name='LEM_DEBUG_TIMING' id='LEM_DEBUG_TIMING' value='Y'/>Detailed Timing</li>
/** * RPC Routine to duplicate a survey * * @access public * @param string $sSessionKey Auth credentials * @param int $iSurveyXML The XML of the survey to import * @return int The key of the new survey created * */ public function duplicate_survey($sSessionKey, $iSurveyID) { // Check sessionkey if (!$this->_checkSessionKey($sSessionKey)) { return array('status' => 'Invalid session key'); } // import getSurveyList function Yii::app()->loadHelper('common'); // NOTE: for one language surveys only $surveys = getSurveyList(TRUE, $iSurveyID); // set a defualt name for the new survey if (count($surveys) > 0) { $new_survey_name = $surveys[0]['surveyls_title'] . ' (copy)'; } else { $new_survey_name = 'New Duplicate Survey'; } // now get the actual name foreach ($surveys as $survey) { if ($survey['sid'] == $iSurveyID) { $new_survey_name = $survey['surveyls_title'] . ' (copy)'; } } // you can use this to get the language code if you want //$sLanguageCode = getBaseLanguageFromSurveyID($iSurveyID); // check to make sure there isn't another survey with the same name foreach ($surveys as $survey) { if ($survey['surveyls_title'] == $new_survey_name) { return array('status' => 'Error: A survey with that name already exists'); } } // export functions //Yii::app()->loadHelper('admin/exportresults'); $aExcludes = array(); // $aExcludes['quotas'] = true; // $aExcludes['permissions'] = true; // $aExcludes['answers'] = true; // $aExcludes['conditions'] = true; // $aExcludes['dates'] = true; if (!Survey::model()->findByPk($iSurveyID)) { return array('status' => 'Error: Invalid survey ID'); } elseif (!Permission::model()->hasSurveyPermission($iSurveyID, 'surveycontent', 'export')) { return array('status' => 'No permissions'); } else { Yii::app()->loadHelper('export'); $copy_survey_data = surveyGetXMLData($iSurveyID, $aExcludes); } // Now, we have the survey lets start importing Yii::app()->loadHelper('admin/import'); // XMLImportSurvey(fileName,data,newName,translateInsertansTags,convertInvalidQuestionCodes) $result = XMLImportSurvey('', $copy_survey_data, $new_survey_name, NULL, TRUE); // (might get used one day) // if (isset($aExcludes['conditions'])) { // Question::model()->updateAll(array('relevance'=>'1'),'sid='.$aImportResults['newsid']); // QuestionGroup::model()->updateAll(array('grelevance'=>'1'),'sid='.$aImportResults['newsid']); // } // if (!isset($aExcludes['permissions'])) { // Permission::model()->copySurveyPermissions($iSurveyID,$aImportResults['newsid']); // } // the error is set in the XMLImportSurvey function if (isset($result['error'])) { return FALSE; } else { return TRUE; } }
<div id='copy'> <form class='form30' action='<?php echo $this->createUrl('admin/survey/copy'); ?>' id='copysurveyform' method='post'> <ul> <li><label for='copysurveylist'><?php $clang->eT("Select survey to copy:"); ?> </label> <select id='copysurveylist' name='copysurveylist' required="required"> <?php echo getSurveyList(false, true); ?> </select> <span class='annotation'><?php echo $clang->gT("Required"); ?> </span></li> <li><label for='copysurveyname'><?php echo $clang->gT("New survey title:"); ?> </label> <input type='text' id='copysurveyname' size='82' maxlength='200' name='copysurveyname' value='' required="required" /> <span class='annotation'><?php echo $clang->gT("Required"); ?> </span></li> <li><label for='copysurveytranslinksfields'><?php echo $clang->gT("Convert resource links and INSERTANS fields?"); ?> </label> <input id='copysurveytranslinksfields' name="copysurveytranslinksfields" type="checkbox" checked='checked'/></li> <li><label for='copysurveyexcludequotas'><?php $clang->eT("Exclude quotas?"); ?></label> <input id='copysurveyexcludequotas' name="copysurveyexcludequotas" type="checkbox" /></li> <li><label for='copysurveyexcludepermissions'><?php echo $clang->gT("Exclude survey permissions?"); ?> </label> <input id='copysurveyexcludepermissions' name="copysurveyexcludepermissions" type="checkbox"/></li> <li><label for='copysurveyexcludeanswers'><?php echo $clang->gT("Exclude answers?"); ?> </label> <input id='copysurveyexcludeanswers' name="copysurveyexcludeanswers" type="checkbox" /></li> <li><label for='copysurveyresetconditions'><?php echo $clang->gT("Reset conditions?"); ?></label> <input id='copysurveyresetconditions' name="copysurveyresetconditions" type="checkbox" /></li> </ul> <p><input type='submit' value='<?php $clang->eT("Copy survey"); ?>' /> <?php if (isset($surveyid)) echo '<input type="hidden" name="sid" value="' . $surveyid . '" />'; ?> <input type='hidden' name='action' value='copysurvey' /></p> </form> </div>
<div id='copy'> <?php echo CHtml::form(array('admin/survey/sa/copy'), 'post', array('id' => 'copysurveyform', 'name' => 'copysurveyform', 'class' => 'form30')); ?> <ul> <li><label for='copysurveylist'><?php $clang->eT("Select survey to copy:"); ?> </label> <select id='copysurveylist' name='copysurveylist' required="required"> <?php echo getSurveyList(false, true); ?> </select> <span class='annotation'><?php echo $clang->gT("Required"); ?> </span></li> <li><label for='copysurveyname'><?php echo $clang->gT("New survey title:"); ?> </label> <input type='text' id='copysurveyname' size='82' maxlength='200' name='copysurveyname' value='' required="required" /> <span class='annotation'><?php echo $clang->gT("Required"); ?> </span></li> <li><label for='copysurveytranslinksfields'><?php echo $clang->gT("Convert resource links and INSERTANS fields?"); ?> </label> <input id='copysurveytranslinksfields' name="copysurveytranslinksfields" type="checkbox" checked='checked'/></li>
/** * Copy survey */ ?> <!-- tab copy survey --> <div id='copy' class="tab-pane fade in"> <!-- copy survey form --> <?php echo CHtml::form(array('admin/survey/sa/copy'), 'post', array('id'=>'copysurveyform', 'name'=>'copysurveyform', 'class'=>'form30 form-horizontal')); ?> <!-- Select survey --> <div class="form-group"> <label for='copysurveylist' class="col-sm-3 control-label"><?php eT("Select survey to copy:"); ?> </label> <div class="col-sm-5"> <select id='copysurveylist' name='copysurveylist' required="required" class="form-control"> <?php echo getSurveyList(false); ?> </select> </div> <div class="col-sm-2"> <p class="form-control-static"> <span class='annotation text-warning'><?php echo gT("Required"); ?> </span> </p> </div> </div> <!-- New survey title --> <div class="form-group"> <label for='copysurveyname' class="col-sm-3 control-label"><?php echo eT("New survey title:"); ?> </label> <div class="col-sm-5"> <input type='text' id='copysurveyname' size='82' maxlength='200' name='copysurveyname' value='' required="required" class="form-control" /> </div>