本文整理汇总了PHP中getGroupDepsForConditions函数的典型用法代码示例。如果您正苦于以下问题:PHP getGroupDepsForConditions函数的具体用法?PHP getGroupDepsForConditions怎么用?PHP getGroupDepsForConditions使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了getGroupDepsForConditions函数的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _questiongroupbar
/**
* Shows admin menu for question groups
* @param int Survey id
* @param int Group id
*/
function _questiongroupbar($iSurveyID, $gid, $qid = null, $action = null)
{
$clang = $this->getController()->lang;
$baselang = Survey::model()->findByPk($iSurveyID)->language;
Yii::app()->loadHelper('replacements');
// TODO: check that surveyid and thus baselang are always set here
$sumresult4 = Questions::model()->findAllByAttributes(array('sid' => $iSurveyID, 'gid' => $gid, 'language' => $baselang));
$sumcount4 = count($sumresult4);
$grpresult = Groups::model()->findAllByAttributes(array('gid' => $gid, 'language' => $baselang));
// Check if other questions/groups are dependent upon this group
$condarray = getGroupDepsForConditions($iSurveyID, "all", $gid, "by-targgid");
$groupsummary = "<div class='menubar'>\n" . "<div class='menubar-title ui-widget-header'>\n";
//$sumquery1 = "SELECT * FROM ".db_table_name('surveys')." inner join ".db_table_name('surveys_languagesettings')." on (surveyls_survey_id=sid and surveyls_language=language) WHERE sid=$iSurveyID"; //Getting data for this survey
$sumresult1 = Survey::model()->with(array('languagesettings' => array('condition' => 'surveyls_language=language')))->findByPk($iSurveyID);
//$sumquery1, 1) ; //Checked // if surveyid is invalid then die to prevent errors at a later time
$surveyinfo = $sumresult1->attributes;
$surveyinfo = array_merge($surveyinfo, $sumresult1->languagesettings[0]->attributes);
$surveyinfo = array_map('flattenText', $surveyinfo);
//$surveyinfo = array_map('htmlspecialchars', $surveyinfo);
$aData['activated'] = $activated = $surveyinfo['active'];
foreach ($grpresult as $grow) {
$grow = $grow->attributes;
$grow = array_map('flattenText', $grow);
$aData = array();
$aData['activated'] = $activated;
$aData['qid'] = $qid;
$aData['QidPrev'] = $QidPrev = getQidPrevious($iSurveyID, $gid, $qid);
$aData['QidNext'] = $QidNext = getQidNext($iSurveyID, $gid, $qid);
if ($action == 'editgroup' || $action == 'addquestion' || $action == 'viewquestion' || $action == "editdefaultvalues") {
$gshowstyle = "style='display: none'";
} else {
$gshowstyle = "";
}
$aData['gshowstyle'] = $gshowstyle;
$aData['surveyid'] = $iSurveyID;
$aData['gid'] = $gid;
$aData['grow'] = $grow;
$aData['clang'] = $clang;
$aData['condarray'] = $condarray;
$aData['sumcount4'] = $sumcount4;
$aData['iIconSize'] = Yii::app()->getConfig('adminthemeiconsize');
$aData['imageurl'] = Yii::app()->getConfig('adminimageurl');
$groupsummary .= $this->getController()->render('/admin/survey/QuestionGroups/questiongroupbar_view', $aData, true);
}
$groupsummary .= "\n</table>\n";
$finaldata['display'] = $groupsummary;
$this->getController()->render('/survey_view', $finaldata);
}
示例2: set_group_properties
/**
* RPC Routine to set group properties.
*
* @access public
* @param string $sSessionKey Auth credentials
* @param integer $iGroupID - ID of the survey
* @param array|struct $aGroupData - An array with the particular fieldnames as keys and their values to set on that particular survey
* @return array Of succeeded and failed modifications according to internal validation.
*/
public function set_group_properties($sSessionKey, $iGroupID, $aGroupData)
{
if ($this->_checkSessionKey($sSessionKey)) {
$oGroup = QuestionGroup::model()->findByAttributes(array('gid' => $iGroupID));
if (is_null($oGroup)) {
return array('status' => 'Error: Invalid group ID');
}
if (Permission::model()->hasSurveyPermission($oGroup->sid, 'survey', 'update')) {
$aResult = array();
// Remove fields that may not be modified
unset($aGroupData['sid']);
unset($aGroupData['gid']);
// Remove invalid fields
$aDestinationFields = array_flip(QuestionGroup::model()->tableSchema->columnNames);
$aGroupData = array_intersect_key($aGroupData, $aDestinationFields);
$aGroupAttributes = $oGroup->getAttributes();
if (empty($aGroupData)) {
return array('status' => 'No valid Data');
}
foreach ($aGroupData as $sFieldName => $sValue) {
//all dependencies this group has
$has_dependencies = getGroupDepsForConditions($oGroup->sid, $iGroupID);
//all dependencies on this group
$depented_on = getGroupDepsForConditions($oGroup->sid, "all", $iGroupID, "by-targgid");
//We do not allow groups with dependencies to change order - that would lead to broken dependencies
if ((isset($has_dependencies) || isset($depented_on)) && $sFieldName == 'group_order') {
$aResult[$sFieldName] = 'Group with dependencies - Order cannot be changed';
continue;
}
$oGroup->setAttribute($sFieldName, $sValue);
try {
// save the change to database - one by one to allow for validation to work
$bSaveResult = $oGroup->save();
fixSortOrderGroups($oGroup->sid);
$aResult[$sFieldName] = $bSaveResult;
//unset failed values
if (!$bSaveResult) {
$oGroup->{$sFieldName} = $aGroupAttributes[$sFieldName];
}
} catch (Exception $e) {
//unset values that cause exception
$oGroup->{$sFieldName} = $aGroupAttributes[$sFieldName];
}
}
return $aResult;
} else {
return array('status' => 'No permission');
}
} else {
return array('status' => 'Invalid Session key');
}
}
示例3: _nquestiongroupbar
function _nquestiongroupbar($aData)
{
if (isset($aData['questiongroupbar'])) {
if (!isset($aData['gid'])) {
if (isset($_GET['gid'])) {
$aData['gid'] = $_GET['gid'];
}
}
$surveyid = $aData['surveyid'];
$gid = $aData['gid'];
$oSurvey = $aData['oSurvey'];
$baselang = $oSurvey->language;
$sumresult4 = Question::model()->findAllByAttributes(array('sid' => $surveyid, 'gid' => $gid, 'language' => $baselang));
$sumcount4 = count($sumresult4);
$aData['sumcount4'] = $sumcount4;
$sumresult1 = Survey::model()->with(array('languagesettings' => array('condition' => 'surveyls_language=language')))->findByPk($surveyid);
//$sumquery1, 1) ; //Checked // if surveyid is invalid then die to prevent errors at a later time
$surveyinfo = $sumresult1->attributes;
$surveyinfo = array_merge($surveyinfo, $sumresult1->defaultlanguage->attributes);
$surveyinfo = array_map('flattenText', $surveyinfo);
//$surveyinfo = array_map('htmlspecialchars', $surveyinfo);
$aData['activated'] = $activated = $surveyinfo['active'];
$condarray = getGroupDepsForConditions($surveyid, "all", $gid, "by-targgid");
$aData['condarray'] = $condarray;
$aData['languagelist'] = $oSurvey->getAllLanguages();
$this->getController()->renderPartial("/admin/survey/QuestionGroups/nquestiongroupbar_view", $aData);
}
}
示例4: view
public function view($surveyid, $gid)
{
$aData = array();
$aData['surveyid'] = $iSurveyID = $surveyid;
$aData['gid'] = $gid;
$baselang = Survey::model()->findByPk($surveyid)->language;
$condarray = getGroupDepsForConditions($surveyid, "all", $gid, "by-targgid");
$aData['condarray'] = $condarray;
$grow = QuestionGroup::model()->findByPk(array('gid' => $gid, 'language' => $baselang));
$grow = $grow->attributes;
$grow = array_map('flattenText', $grow);
$aData['surveyid'] = $surveyid;
$aData['gid'] = $gid;
$aData['grow'] = $grow;
$aData['sidemenu']['questiongroups'] = true;
$aData['sidemenu']['group_name'] = $grow['group_name'];
$surveyinfo = Survey::model()->findByPk($iSurveyID)->surveyinfo;
$aData['title_bar']['title'] = $surveyinfo['surveyls_title'] . "(" . gT("ID") . ":" . $iSurveyID . ")";
$aData['questiongroupbar']['buttons']['view'] = true;
///////////
// sidemenu
$aData['sidemenu']['state'] = true;
$aData['sidemenu']['explorer']['state'] = true;
$aData['sidemenu']['explorer']['gid'] = isset($gid) ? $gid : false;
$aData['sidemenu']['explorer']['qid'] = false;
$this->_renderWrappedTemplate('survey/QuestionGroups', 'group_view', $aData);
}
示例5: getbuttons
public function getbuttons()
{
// Find out if the survey is active to disable add-button
$oSurvey = Survey::model()->findByPk($this->sid);
$surveyIsActive = $oSurvey->active !== 'N';
$baselang = $oSurvey->language;
// Add question to this group
$url = Yii::app()->createUrl("admin/questions/sa/newquestion/surveyid/{$this->sid}/gid/{$this->gid}");
$button = '<a class="btn btn-default list-btn ' . ($surveyIsActive ? 'disabled' : '') . ' " data-toggle="tooltip" data-placement="left" title="' . gT('Add new question to group') . '" href="' . $url . '" role="button"><span class="glyphicon glyphicon-plus-sign " ></span></a>';
// Group edition
// Edit
$url = Yii::app()->createUrl("admin/questiongroups/sa/edit/surveyid/{$this->sid}/gid/{$this->gid}");
$button .= ' <a class="btn btn-default list-btn" href="' . $url . '" role="button" data-toggle="tooltip" title="' . gT('Edit group') . '"><span class="glyphicon glyphicon-pencil " ></span></a>';
// View summary
$url = Yii::app()->createUrl("/admin/questiongroups/sa/view/surveyid/");
$url .= '/' . $this->sid . '/gid/' . $this->gid;
$button .= ' <a class="btn btn-default list-btn" href="' . $url . '" role="button" data-toggle="tooltip" title="' . gT('Group summary') . '"><span class="glyphicon glyphicon-list-alt " ></span></a>';
$iQuestionsInGroup = Question::model()->countByAttributes(array('sid' => $this->sid, 'gid' => $this->gid, 'language' => $baselang));
// Delete
if ($oSurvey->active != "Y" && Permission::model()->hasSurveyPermission($this->sid, 'surveycontent', 'delete') && $iQuestionsInGroup > 0) {
$condarray = getGroupDepsForConditions($this->sid, "all", $this->gid, "by-targgid");
if (is_null($condarray)) {
$confirm = 'if (confirm(\'' . gT("Deleting this group will also delete any questions and answers it contains. Are you sure you want to continue?", "js") . '\')) { window.open(\'' . Yii::app()->createUrl("admin/questiongroups/sa/delete/surveyid/{$this->sid}/gid/{$this->gid}") . '\',\'_top\'); };';
$button .= '<a class="btn btn-default" data-toggle="tooltip" title="' . gT("Delete") . '" href="#" role="button"
onclick="' . $confirm . '">
<span class="text-danger glyphicon glyphicon-trash"></span>
</a>';
} else {
$alert = 'alert(\'' . gT("Impossible to delete this group because there is at least one question having a condition on its content", "js") . '\'); return false;';
$button .= '<a class="btn btn-default" data-toggle="tooltip" title="' . gT("Delete") . '" href="#" role="button"
onclick="' . $alert . '">
<span class="text-danger glyphicon glyphicon-trash"></span>
</a>';
}
}
return $button;
}
示例6: _nquestiongroupbar
/**
* Show admin menu for question group view
*
* @param array $aData ?
*/
function _nquestiongroupbar($aData)
{
if (isset($aData['questiongroupbar'])) {
if (!isset($aData['gid'])) {
if (isset($_GET['gid'])) {
$aData['gid'] = $_GET['gid'];
}
}
$aData['surveyIsActive'] = $aData['oSurvey']->active !== 'N';
$surveyid = $aData['surveyid'];
$gid = $aData['gid'];
$oSurvey = $aData['oSurvey'];
$baselang = $oSurvey->language;
$aData['sumcount4'] = Question::model()->countByAttributes(array('sid' => $surveyid, 'gid' => $gid, 'language' => $baselang));
$sumresult1 = Survey::model()->with(array('languagesettings' => array('condition' => 'surveyls_language=language')))->findByPk($surveyid);
//$sumquery1, 1) ; //Checked // if surveyid is invalid then die to prevent errors at a later time
$surveyinfo = $sumresult1->attributes;
$surveyinfo = array_merge($surveyinfo, $sumresult1->defaultlanguage->attributes);
$surveyinfo = array_map('flattenText', $surveyinfo);
//$surveyinfo = array_map('htmlspecialchars', $surveyinfo);
$aData['activated'] = $activated = $surveyinfo['active'];
$condarray = getGroupDepsForConditions($surveyid, "all", $gid, "by-targgid");
$aData['condarray'] = $condarray;
$aData['languagelist'] = $oSurvey->getAllLanguages();
if (isset($aData['questiongroupbar']['closebutton']['url'])) {
$sAlternativeUrl = $aData['questiongroupbar']['closebutton']['url'];
$aForbiddenWordsInUrl = array('add');
$aData['questiongroupbar']['closebutton']['url'] = Yii::app()->request->getUrlReferrer(Yii::app()->createUrl($sAlternativeUrl), $aForbiddenWordsInUrl);
}
$this->getController()->renderPartial("/admin/survey/QuestionGroups/questiongroupbar_view", $aData);
}
}
示例7: view
public function view($surveyid, $gid)
{
$aData = array();
$aData['surveyid'] = $iSurveyID = $surveyid;
$aData['gid'] = $gid;
$baselang = Survey::model()->findByPk($surveyid)->language;
$condarray = getGroupDepsForConditions($surveyid, "all", $gid, "by-targgid");
$aData['condarray'] = $condarray;
$grow = QuestionGroup::model()->findByPk(array('gid' => $gid, 'language' => $baselang));
$grow = $grow->attributes;
$grow = array_map('flattenText', $grow);
$aData['surveyid'] = $surveyid;
$aData['gid'] = $gid;
$aData['grow'] = $grow;
$aData['sidebar']['questiongroups'] = true;
$aData['sidebar']['group_name'] = $grow['group_name'];
$surveyinfo = Survey::model()->findByPk($iSurveyID)->surveyinfo;
$aData['title_bar']['title'] = $surveyinfo['surveyls_title'] . "(" . gT("ID") . ":" . $iSurveyID . ")";
$aData['questiongroupbar']['buttons']['view'] = TRUE;
//$aData['questiongroupbar']['returnbutton']['url'] = $this->getController()->createUrl("admin/survey/sa/listquestiongroups/", array('surveyid'=>$surveyid));
//$aData['questiongroupbar']['returnbutton']['text'] = gT('return to question group list');
$this->_renderWrappedTemplate('survey/QuestionGroups', 'group_view', $aData);
}