Ejemplo n.º 1
0
<?php

$tpl = erLhcoreClassTemplate::getInstance('lhsurvey/collected.tpl.php');
$survey = erLhAbstractModelSurvey::fetch((int) $Params['user_parameters']['survey_id']);
if (isset($_GET['doSearch'])) {
    $filterParams = erLhcoreClassSearchHandler::getParams(array('module' => 'survey', 'module_file' => 'survey_search', 'format_filter' => true, 'use_override' => true, 'uparams' => $Params['user_parameters_unordered']));
    $filterParams['is_search'] = true;
} else {
    $filterParams = erLhcoreClassSearchHandler::getParams(array('module' => 'survey', 'module_file' => 'survey_search', 'format_filter' => true, 'uparams' => $Params['user_parameters_unordered']));
    $filterParams['is_search'] = false;
}
$append = erLhcoreClassSearchHandler::getURLAppendFromInput($filterParams['input_form']);
$filterParams['filter']['filter']['survey_id'] = $survey->id;
if ($Params['user_parameters_unordered']['print'] == 1) {
    $tpl = erLhcoreClassTemplate::getInstance('lhsurvey/printsurvey.tpl.php');
    $items = erLhAbstractModelSurveyItem::getList(array_merge($filterParams['filter'], array('offset' => 0, 'limit' => 100000)));
    $tpl->set('items', $items);
    $Result['content'] = $tpl->fetch();
    $Result['pagelayout'] = 'print';
    return;
}
$pages = new lhPaginator();
$pages->serverURL = erLhcoreClassDesign::baseurl('survey/collected') . '/' . $survey->id . $append;
$pages->items_total = erLhAbstractModelSurveyItem::getCount($filterParams['filter']);
$pages->setItemsPerPage(20);
$pages->paginate();
$items = array();
if ($pages->items_total > 0) {
    $items = erLhAbstractModelSurveyItem::getList(array_merge($filterParams['filter'], array('offset' => $pages->low, 'limit' => $pages->items_per_page)));
}
$tpl->set('items', $items);
Ejemplo n.º 2
0
 if (is_numeric((string) $Params['user_parameters_unordered']['chatid']) && $Params['user_parameters_unordered']['chatid'] > 0) {
     if ((string) $Params['user_parameters_unordered']['hash'] != '') {
         $hash = $Params['user_parameters_unordered']['hash'];
     }
     if (is_numeric($Params['user_parameters_unordered']['chatid'])) {
         $chat = erLhcoreClassModelChat::fetch($Params['user_parameters_unordered']['chatid']);
     }
 } else {
     if ((string) $Params['user_parameters_unordered']['hash'] != '') {
         list($chatID, $hash) = explode('_', $Params['user_parameters_unordered']['hash']);
         $chat = erLhcoreClassModelChat::fetch($chatID);
     }
 }
 erLhcoreClassChat::setTimeZoneByChat($chat);
 if ($chat->hash == $hash) {
     $survey = erLhAbstractModelSurvey::fetch($Params['user_parameters_unordered']['survey']);
     if ($survey instanceof erLhAbstractModelSurvey) {
         $surveyItem = erLhAbstractModelSurveyItem::getInstance($chat, $survey);
         if (isset($_POST['Vote'])) {
             $errors = erLhcoreClassSurveyValidator::validateSurvey($surveyItem, $survey);
             if (empty($errors)) {
                 $surveyItem->saveOrUpdate();
                 erLhcoreClassChatEventDispatcher::getInstance()->dispatch('survey.filled', array('chat' => &$chat, 'survey' => $survey, 'survey_item' => &$surveyItem));
                 $tpl->set('just_stored', true);
             } else {
                 $tpl->set('errors', $errors);
             }
         }
         $tpl->set('chat', $chat);
         $tpl->set('survey', $survey);
         $tpl->set('survey_item', $surveyItem);
Ejemplo n.º 3
0
<?php

$item = erLhAbstractModelSurveyItem::fetch((int) $Params['user_parameters']['id']);
$tpl = erLhcoreClassTemplate::getInstance('lhsurvey/collecteditem.tpl.php');
$tpl->set('survey_item', $item);
$tpl->set('survey', erLhAbstractModelSurvey::fetch($item->survey_id));
echo $tpl->fetch();
exit;