public function removeInstanceData()
 {
     foreach (erLhAbstractModelFormCollected::getList(array('limit' => 1000000)) as $item) {
         $item->removeThis();
     }
     foreach (erLhAbstractModelWidgetTheme::getList(array('limit' => 1000000)) as $item) {
         $item->removeThis();
     }
     foreach (erLhcoreClassChat::getList(array('limit' => 1000000)) as $item) {
         $item->removeThis();
     }
     foreach (erLhcoreClassChat::getList(array('limit' => 1000000), 'erLhcoreClassModelChatFile', 'lh_chat_file') as $item) {
         $item->removeThis();
     }
     foreach (erLhcoreClassModelUser::getUserList(array('limit' => 1000000)) as $item) {
         $item->removeFile();
     }
     // Dispatch event for extensions
     erLhcoreClassChatEventDispatcher::getInstance()->dispatch('instance.destroyed', array('instance' => $this));
     return true;
 }
예제 #2
0
    // Delete selected canned message
    try {
        if (!$currentUser->validateCSFRToken($Params['user_parameters_unordered']['csfr'])) {
            die('Invalid CSRF Token');
            exit;
        }
        $collected = erLhAbstractModelFormCollected::fetch((int) $Params['user_parameters_unordered']['id']);
        $collected->removeThis();
    } catch (Exception $e) {
        // Do nothing
    }
    erLhcoreClassModule::redirect('form/collected', '/' . $form->id);
    exit;
}
$pages = new lhPaginator();
$pages->serverURL = erLhcoreClassDesign::baseurl('form/collected') . '/' . $form->id;
$pages->items_total = erLhAbstractModelFormCollected::getCount(array('filter' => array('form_id' => $form->id)));
$pages->setItemsPerPage(20);
$pages->paginate();
$items = array();
if ($pages->items_total > 0) {
    $items = erLhAbstractModelFormCollected::getList(array('filter' => array('form_id' => $form->id), 'offset' => $pages->low, 'limit' => $pages->items_per_page, 'sort' => 'id DESC'));
}
$tpl->set('items', $items);
$tpl->set('pages', $pages);
$tpl->set('form', $form);
$Result['content'] = $tpl->fetch();
$object_trans = $form->getModuleTranslations();
$Result['path'][] = $object_trans['path'];
$Result['path'][] = array('url' => erLhcoreClassDesign::baseurl('abstract/list') . '/Form', 'title' => $object_trans['name']);
$Result['path'][] = array('title' => (string) $form);
예제 #3
0
 public static function storeCollectedInformation($form, $collectedInformation)
 {
     $formCollected = new erLhAbstractModelFormCollected();
     $formCollected->ip = erLhcoreClassIPDetect::getIP();
     $formCollected->ctime = time();
     $formCollected->form_id = $form->id;
     $formCollected->identifier = isset($_POST['identifier']) ? $_POST['identifier'] : (isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '');
     $formCollected->saveThis();
     // Finish collect information
     foreach ($collectedInformation as $fieldName => &$params) {
         if ($params['definition']['type'] == 'file') {
             $dir = 'var/storageform/' . date('Y') . 'y/' . date('m') . '/' . date('d') . '/' . $formCollected->id . '/';
             erLhcoreClassChatEventDispatcher::getInstance()->dispatch('form.fill.file_path', array('path' => &$dir, 'storage_id' => $formCollected->id));
             erLhcoreClassFileUpload::mkdirRecursive($dir);
             $file = erLhcoreClassSearchHandler::moveUploadedFile($params['definition']['name'], $dir);
             $params['filename'] = $file;
             $params['filepath'] = $dir;
             erLhcoreClassChatEventDispatcher::getInstance()->dispatch('form.fill.store_file', array('file_params' => &$params));
         }
     }
     $formCollected->content = serialize($collectedInformation);
     $formCollected->saveThis();
     // Inform user about filled form
     erLhcoreClassChatMail::informFormFilled($formCollected, array('email' => self::$mainEmail));
 }
<?php

$form = erLhAbstractModelForm::fetch((int) $Params['user_parameters']['form_id']);
$items = erLhAbstractModelFormCollected::getList(array('filter' => array('form_id' => $form->id), 'offset' => 0, 'limit' => 100000, 'sort' => 'id ASC'));
include 'lib/core/lhform/PHPExcel.php';
$objPHPExcel = new PHPExcel();
$objPHPExcel->setActiveSheetIndex(0);
$objPHPExcel->getActiveSheet()->getStyle('A1:AW1')->getFont()->setBold(true);
// Set width
foreach ($form->xls_columns_data as $key => $data) {
    if (isset($data['width'])) {
        $objPHPExcel->getActiveSheet()->getColumnDimensionByColumn($key)->setWidth($data['width']);
    }
}
// Set header
$i = 0;
foreach ($form->xls_columns_data as $data) {
    $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow($i, 1, $data['name']);
    $i++;
}
$objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow($i, 1, erTranslationClassLhTranslation::getInstance()->getTranslation('form/index', 'Date'));
$i++;
$objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow($i, 1, 'IP');
$i++;
$objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow($i, 1, erTranslationClassLhTranslation::getInstance()->getTranslation('form/index', 'Identifier'));
// Set data
$i = 2;
foreach ($items as $item) {
    $y = 0;
    foreach ($form->xls_columns_data as $data) {
        if (isset($item->content_array[$data['attr_name']]['definition']['type']) && $item->content_array[$data['attr_name']]['definition']['type'] == 'file') {
예제 #5
0
<?php

try {
    $file = erLhAbstractModelFormCollected::fetch((int) $Params['user_parameters']['collected_id']);
    $attr_name = $Params['user_parameters']['attr_name'];
    if (isset($file->content_array[$attr_name])) {
        $type = $file->content_array[$attr_name]['value']['type'];
        $array = explode('.', $file->content_array[$attr_name]['value']['name']);
        $ext = end($array);
        header('Content-type: ' . $type);
        header('Content-Disposition: attachment; filename="' . $attr_name . '.' . $ext . '"');
        echo file_get_contents($file->content_array[$attr_name]['filepath'] . $file->content_array[$attr_name]['filename']);
    }
} catch (Exception $e) {
    header('Location: /');
    exit;
}
exit;