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; }
// 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);
<?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') {