/** * Print out statistics about the language */ function statisticsObject() { $modules = ilObjLanguageExt::_getModules($this->object->key); $data = array(); $total = array("", 0, 0, 0); foreach ($modules as $module) { $row = array(); $row[0] = $module; $row[1] = count($this->object->getAllValues(array($module))); $row[2] = count($this->object->getChangedValues(array($module))); $row[3] = $row[1] - $row[2]; $total[1] += $row[1]; $total[2] += $row[2]; $total[3] += $row[3]; $data[] = $row; } $total[0] = "<b>" . $this->lng->txt("language_all_modules") . "</b>"; $total[1] = "<b>" . $total[1] . "</b>"; $total[2] = "<b>" . $total[2] . "</b>"; $total[3] = "<b>" . $total[3] . "</b>"; $data[] = $total; // prepare the templates for output $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.lang_statistics.html", "Services/Language"); $this->tpl->addBlockFile("TABLE_STATISTICS", "table_statistics", "tpl.table.html"); $this->tpl->addBlockFile("TBL_CONTENT", "tbl_content", "tpl.obj_tbl_rows.html"); // create and configure the table object include_once 'Services/Table/classes/class.ilTableGUI.php'; $tbl = new ilTableGUI(); $tbl->disable('title'); $tbl->disable('sort'); $tbl->disable('numinfo'); $tbl->setHeaderNames(array($this->lng->txt("module"), $this->lng->txt("language_scope_global"), $this->lng->txt("language_scope_local"), $this->lng->txt("language_scope_unchanged"))); $tbl->setColumnWidth(array("25%", "25%", "25%", "25%")); $tbl->setLimit(count($data)); $tbl->setData($data); // show the table $tbl->render(); // $this->tpl->show(); }
/** * 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()); }
/** * Init filter */ function initFilter() { global $lng; // most filters are only if (!ilObjLanguageAccess::_isPageTranslation()) { // pattern include_once "./Services/Form/classes/class.ilTextInputGUI.php"; $ti = new ilTextInputGUI($lng->txt("search"), "pattern"); $ti->setParent($this->parent_obj); $ti->setMaxLength(64); $ti->setSize(20); $this->addFilterItem($ti); $ti->readFromSession(); // module $options = array(); $options["all"] = $lng->txt("language_all_modules"); $modules = ilObjLanguageExt::_getModules($lng->getLangKey()); foreach ($modules as $mod) { $options[$mod] = $mod; } include_once "./Services/Form/classes/class.ilSelectInputGUI.php"; $si = new ilSelectInputGUI(ucfirst($lng->txt("module")), "module"); $si->setParent($this->parent_obj); $si->setOptions($options); $this->addFilterItem($si); $si->readFromSession(); if (!$si->getValue()) { $si->setValue('administration'); } // mode $options = array(); $options["all"] = $lng->txt("language_scope_global"); $options["changed"] = $lng->txt("language_scope_local"); if ($this->params['langmode']) { $options["added"] = $lng->txt("language_scope_added"); } $options["unchanged"] = $lng->txt("language_scope_unchanged"); $options["equal"] = $lng->txt("language_scope_equal"); $options["different"] = $lng->txt("language_scope_different"); $options["commented"] = $lng->txt("language_scope_commented"); if ($this->params['langmode']) { $options["dbremarks"] = $lng->txt("language_scope_dbremarks"); } $options["conflicts"] = $lng->txt("language_scope_conflicts"); include_once "./Services/Form/classes/class.ilSelectInputGUI.php"; $si = new ilSelectInputGUI($lng->txt("filter"), "mode"); $si->setParent($this->parent_obj); $si->setOptions($options); $this->addFilterItem($si); $si->readFromSession(); if (!$si->getValue()) { $si->setValue('all'); } } //compare $options = array(); $langlist = $lng->getInstalledLanguages(); foreach ($langlist as $lang_key) { $options[$lang_key] = $lng->txt("meta_l_" . $lang_key); } include_once "./Services/Form/classes/class.ilSelectInputGUI.php"; $si = new ilSelectInputGUI($lng->txt("language_compare"), "compare"); $si->setParent($this->parent_obj); $si->setOptions($options); $this->addFilterItem($si); $si->readFromSession(); if (!$si->getValue()) { $si->setValue($lng->getDefaultLanguage()); } }