public function __get($var)
 {
     switch ($var) {
         case 'votes':
             $this->votes = erLhcoreClassQuestionary::getCount(array('filter' => array('option_id' => $this->id)), 'lh_question_option_answer');
             return $this->votes;
             break;
         default:
             break;
     }
 }
 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;
     }
 }
Пример #3
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')));
Пример #4
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')));
Пример #5
0
            $answer->saveThis();
            erLhcoreClassChatEventDispatcher::getInstance()->dispatch('questionaire.feedback_left', array('feedback' => &$answer));
            $tpl->set('received', true);
        } else {
            $tpl->set('errors', $Errors);
        }
    }
}
if ($votingRelative !== false) {
    $baseFilter = array('filter' => array('question_id' => $votingRelative->id, 'ip' => ip2long(erLhcoreClassIPDetect::getIP())));
    if ($votingRelative->revote > 0) {
        $baseFilter['filtergt']['ctime'] = time() - $votingRelative->revote_seconds;
    }
    if ($votingRelative->is_voting == 1) {
        if (erLhcoreClassQuestionary::getCount($baseFilter, 'lh_question_option_answer') > 0) {
            $tpl->set('already_voted', true);
        }
    } elseif (erLhcoreClassQuestionary::getCount($baseFilter, 'lh_question_answer') > 0) {
        $tpl->set('already_voted', true);
    }
}
$tpl->set('voting', $votingRelative);
$tpl->set('answer', $answer);
$Result['content'] = $tpl->fetch();
$Result['pagelayout'] = 'widget';
$Result['dynamic_height'] = true;
$Result['dynamic_height_message'] = 'lhc_sizing_questionary';
if ($embedMode == true) {
    $Result['dynamic_height_message'] = 'lhc_sizing_questionary_page';
    $Result['pagelayout_css_append'] = 'embed-widget';
}