public function __get($var)
 {
     switch ($var) {
         case 'total_votes':
             $this->total_votes = erLhcoreClassQuestionary::getCount(array('filter' => array('question_id' => $this->id)), 'lh_question_option_answer');
             return $this->total_votes;
             break;
         case 'total_votes_for_percentange':
             $this->total_votes_for_percentange = $this->total_votes == 0 ? 1 : $this->total_votes;
             return $this->total_votes_for_percentange;
             break;
         case 'revote_seconds':
             $this->revote_seconds = $this->revote * 3600;
             return $this->revote_seconds;
             break;
         case 'options':
             $this->options = erLhcoreClassQuestionary::getList(array('sort' => 'priority DESC', 'filter' => array('question_id' => $this->id)), 'erLhcoreClassModelQuestionOption', 'lh_question_option');
             return $this->options;
             break;
         default:
             break;
     }
 }
Пример #2
0
        $Option->question_id = $Question->id;
        $Option->saveThis();
        // Mark question as it's voting
        $Question->is_voting = 1;
        $Question->saveThis();
        erLhcoreClassModule::redirect('questionary/edit', '/' . $Question->id . '/(tab)/voting');
        exit;
    } else {
        $tpl->set('errors', $Errors);
    }
}
if (isset($_POST['CancelO'])) {
    erLhcoreClassModule::redirect('questionary/edit', '/' . $Question->id . '/(tab)/voting');
    exit;
}
// Answers
$pages = new lhPaginator();
$pages->serverURL = erLhcoreClassDesign::baseurl('questionary/edit') . '/' . $Question->id . '/(tab)/answers';
$pages->items_total = erLhcoreClassQuestionary::getCount(array('filter' => array('question_id' => $Question->id)), 'lh_question_answer');
$pages->setItemsPerPage(20);
$pages->paginate();
$items = array();
if ($pages->items_total > 0) {
    $items = erLhcoreClassQuestionary::getList(array('filter' => array('question_id' => $Question->id), 'offset' => $pages->low, 'limit' => $pages->items_per_page), 'erLhcoreClassModelQuestionAnswer', 'lh_question_answer');
}
$tpl->set('items', $items);
$tpl->set('pages', $pages);
$tpl->set('question', $Question);
$tpl->set('option', $Option);
$Result['content'] = $tpl->fetch();
$Result['path'] = array(array('url' => erLhcoreClassDesign::baseurl('questionary/list'), 'title' => erTranslationClassLhTranslation::getInstance()->getTranslation('questionary/list', 'Questionary')), array('title' => erTranslationClassLhTranslation::getInstance()->getTranslation('questionary/edit', 'Edit a question')));
Пример #3
0
<?php

$tpl = erLhcoreClassTemplate::getInstance('lhquestionary/list.tpl.php');
$pages = new lhPaginator();
$pages->serverURL = erLhcoreClassDesign::baseurl('questionary/list');
$pages->items_total = erLhcoreClassQuestionary::getCount();
$pages->setItemsPerPage(20);
$pages->paginate();
$items = array();
if ($pages->items_total > 0) {
    $items = erLhcoreClassQuestionary::getList(array('offset' => $pages->low, 'limit' => $pages->items_per_page));
}
$tpl->set('items', $items);
$tpl->set('pages', $pages);
$Result['content'] = $tpl->fetch();
$Result['path'] = array(array('url' => erLhcoreClassDesign::baseurl('questionary/list'), 'title' => erTranslationClassLhTranslation::getInstance()->getTranslation('questionary/list', 'Questionary')));
Пример #4
0
?>
"/>
      <input type="submit" class="btn btn-default" name="CancelO" value="<?php 
echo erTranslationClassLhTranslation::getInstance()->getTranslation('questionary/edit', 'Cancel');
?>
"/>
    </div>

	<?php 
include erLhcoreClassDesign::designtpl('lhkernel/csfr_token.tpl.php');
?>

</form>

<?php 
$optionsItems = erLhcoreClassQuestionary::getList(array('sort' => 'priority DESC', 'filter' => array('question_id' => $question->id)), 'erLhcoreClassModelQuestionOption', 'lh_question_option');
if (!empty($optionsItems)) {
    ?>
<table class="table" cellpadding="0" cellspacing="0">
<thead>
<tr>
    <th width="1%">ID</th>
    <th><?php 
    echo erTranslationClassLhTranslation::getInstance()->getTranslation('questionary/edit', 'Option');
    ?>
</th>
    <th class="one"><?php 
    echo erTranslationClassLhTranslation::getInstance()->getTranslation('questionary/edit', 'Position');
    ?>
</th>
    <th width="1%">&nbsp;</th>