/** * Print out statistics about the language */ function statisticsObject() { $modules = ilObjLanguageExt::_getModules($this->object->key); $data = array(); $total = array("module" => '', "all" => 0, "changed" => 0, "unchanged" => 0); foreach ($modules as $module) { $row = array(); $row['module'] = $module; $row['all'] = count($this->object->getAllValues(array($module))); $row['changed'] = count($this->object->getChangedValues(array($module))); $row['unchanged'] = $row['all'] - $row['changed']; $total['all'] += $row['all']; $total['changed'] += $row['changed']; $total['unchanged'] += $row['unchanged']; $data[] = $row; } $total['module'] = "<b>" . $this->lng->txt("language_all_modules") . "</b>"; $total['all'] = "<b>" . $total['all'] . "</b>"; $total['changed'] = "<b>" . $total['changed'] . "</b>"; $total['unchanged'] = "<b>" . $total['unchanged'] . "</b>"; $data[] = $total; // create and configure the table object include_once 'Services/Table/classes/class.ilTable2GUI.php'; $table_gui = new ilTable2GUI($this, "statistics"); $table_gui->setRowTemplate("tpl.lang_statistics_row.html", "Services/Language"); $table_gui->setEnableTitle(false); $table_gui->setEnableNumInfo(false); $table_gui->setLimit(count($data)); $table_gui->setExportFormats(array(ilTable2GUI::EXPORT_EXCEL)); $table_gui->addColumn(ucfirst($this->lng->txt("module")), "", "25%"); $table_gui->addColumn($this->lng->txt("language_scope_global"), "", "25%"); $table_gui->addColumn($this->lng->txt("language_scope_local"), "", "25%"); $table_gui->addColumn($this->lng->txt("language_scope_unchanged"), "", "25%"); $table_gui->setData($data); $this->tpl->setContent($table_gui->getHTML()); }
public function showArchive($confirmation_gui = '') { global $ilUser, $tpl, $ilTabs, $ilSetting, $rbacreview; $ilTabs->setSubTabActive('archive'); include_once 'Services/Payment/classes/class.ilShopNewsItemList.php'; include_once 'Services/Table/classes/class.ilTable2GUI.php'; $news_tpl = new ilTemplate('tpl.main_view.html', true, true, 'Services/Payment'); if ((int) strlen($confirmation_gui)) { $news_tpl->setVariable('CONFIRMATION', $confirmation_gui); } $tbl = new ilTable2GUI($this); $tbl->setId('shop_news_archive_tbl'); $tbl->setTitle($this->lng->txt('archive'), 'icon_news.png', $this->lng->txt('news')); $tbl->setRowTemplate('tpl.shop_news_row.html', 'Services/Payment'); $tbl->setFormAction($this->ctrl->getFormAction($this), 'showArchive'); $tbl->addColumn($this->lng->txt('archive'), 'title', '100%'); $oNewsList = ilShopNewsItemList::_getInstance(); $oNewsList->setMode(ilShopNewsItemList::TYPE_ARCHIVE)->setPublicSection($ilUser->getId() == ANONYMOUS_USER_ID)->setArchiveDate(time() - $ilSetting->get('payment_news_archive_period') * 24 * 60 * 60)->read(); $result = array(); if ($oNewsList->hasItems()) { $tbl->setEnableTitle(true); $tbl->setEnableHeader(true); $counter = 0; foreach ($oNewsList as $entry) { if ($entry->getVisibility() != 'public' && $ilUser->getId() == ANONYMOUS_USER_ID) { continue; } if (strtotime($entry->getCreationDate()) > time() - $ilSetting->get('payment_news_archive_period') * 24 * 60 * 60) { continue; } if ($rbacreview->isAssigned($ilUser->getId(), SYSTEM_ROLE_ID) == true) { $this->ctrl->setParameter($this, 'news_id', $entry->getId()); $result[$counter]['news_id'] = $entry->getId(); $result[$counter]['edit_src'] = $this->ctrl->getLinkTarget($this, 'editArchiveNews'); $result[$counter]['edit_txt'] = $this->lng->txt('edit'); $result[$counter]['delete_src'] = $this->ctrl->getLinkTarget($this, 'confirmDeleteArchiveNews'); $result[$counter]['delete_txt'] = $this->lng->txt('delete'); $this->ctrl->clearParameters($this); } $result[$counter]['creation_date'] = ilDatePresentation::formatDate(new ilDateTime($entry->getCreationDate(), IL_CAL_DATETIME)); $result[$counter]['title'] = $entry->getTitle(); $result[$counter]['content'] = $entry->getContent(); $result[$counter]['user_id'] = $entry->getUserId(); $result[$counter]['author'] = $ilUser->getLogin(); $result[$counter]['creation_date'] = ilDatePresentation::formatDate(new ilDateTime($entry->getCreationDate(), IL_CAL_DATETIME)); $result[$counter]['update_date'] = ilDatePresentation::formatDate(new ilDateTime($entry->getCreationDate(), IL_CAL_DATETIME)); $result[$counter]['txt_author'] = $this->lng->txt('author'); $result[$counter]['txt_creation_date'] = $this->lng->txt('create_date'); $result[$counter]['txt_update_date'] = $this->lng->txt('last_update'); $this->ctrl->clearParameters($this); ++$counter; } } else { $tbl->setNoEntriesText($this->lng->txt('payment_news_no_news_items')); } $tbl->setData($result); $news_tpl->setVariable('TABLE', $tbl->getHTML()); $tpl->setContent($news_tpl->get()); }