本文整理汇总了PHP中ilPlugin::getAvailableLangFiles方法的典型用法代码示例。如果您正苦于以下问题:PHP ilPlugin::getAvailableLangFiles方法的具体用法?PHP ilPlugin::getAvailableLangFiles怎么用?PHP ilPlugin::getAvailableLangFiles使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ilPlugin
的用法示例。
在下文中一共展示了ilPlugin::getAvailableLangFiles方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: gatherPluginData
/**
* Process plugin data for table row
*
* @param strng $a_type
* @param ilPluginSlot $a_slot
* @param string $a_slot_subdir
* @param array $a_plugin
* @return array
*/
protected function gatherPluginData($a_type, ilPluginSlot $a_slot, $a_slot_subdir, array $a_plugin)
{
global $ilCtrl;
$conf = false;
if (ilPlugin::hasConfigureClass($a_slot->getPluginsDirectory(), $a_plugin["name"]) && $ilCtrl->checkTargetClass(ilPlugin::getConfigureClassName($a_plugin["name"]))) {
$conf = true;
}
return array("slot_name" => $a_slot->getSlotName(), "component_type" => $a_type, "component_name" => $a_slot_subdir, "slot_id" => $a_slot->getSlotId(), "plugin_id" => $a_plugin["id"], "plugin_name" => $a_plugin["name"], "plugin_active" => $a_plugin["is_active"], "activation_possible" => $a_plugin["activation_possible"], "needs_update" => $a_plugin["needs_update"], "has_conf" => $conf, "has_lang" => (bool) sizeof(ilPlugin::getAvailableLangFiles($a_slot->getPluginsDirectory() . "/" . $a_plugin["name"] . "/lang")));
}
示例2: showPlugin
function showPlugin()
{
global $ilCtrl, $ilTabs, $lng, $tpl, $ilDB, $ilToolbar;
if (!$_GET["ctype"] || !$_GET["cname"] || !$_GET["slot_id"] || !$_GET["plugin_id"]) {
$ilCtrl->redirect($this, "listPlugins");
}
include_once "./Services/Component/classes/class.ilPluginSlot.php";
$slot = new ilPluginSlot($_GET["ctype"], $_GET["cname"], $_GET["slot_id"]);
$plugin = null;
foreach ($slot->getPluginsInformation() as $item) {
if ($item["id"] == $_GET["plugin_id"]) {
$plugin = $item;
break;
}
}
if (!$plugin) {
$ilCtrl->redirect($this, "listPlugins");
}
$ilTabs->clearTargets();
$ilTabs->setBackTarget($lng->txt("cmps_plugins"), $ilCtrl->getLinkTarget($this, "listPlugins"));
$ilCtrl->setParameter($this, "ctype", $_GET["ctype"]);
$ilCtrl->setParameter($this, "cname", $_GET["cname"]);
$ilCtrl->setParameter($this, "slot_id", $_GET["slot_id"]);
$ilCtrl->setParameter($this, "plugin_id", $_GET["plugin_id"]);
$ilCtrl->setParameter($this, "pname", $plugin["name"]);
$langs = ilPlugin::getAvailableLangFiles($slot->getPluginsDirectory() . "/" . $plugin["name"] . "/lang");
// dbupdate
$file = ilPlugin::getDBUpdateScriptName($_GET["ctype"], $_GET["cname"], ilPluginSlot::lookupSlotName($_GET["ctype"], $_GET["cname"], $_GET["slot_id"]), $plugin["name"]);
$db_curr = $db_file = null;
if (@is_file($file)) {
include_once "./Services/Component/classes/class.ilPluginDBUpdate.php";
$dbupdate = new ilPluginDBUpdate($_GET["ctype"], $_GET["cname"], $_GET["slot_id"], $plugin["name"], $ilDB, true, "");
$db_curr = $dbupdate->getCurrentVersion();
$db_file = $dbupdate->getFileVersion();
/* update command
if ($db_file > $db_curr)
{
$ilToolbar->addButton($lng->txt("cmps_update_db"),
$ilCtrl->getLinkTarget($this, "updatePluginDB"));
} */
}
// toolbar actions
if ($plugin["activation_possible"]) {
$ilToolbar->addButton($lng->txt("cmps_activate"), $ilCtrl->getLinkTarget($this, "activatePlugin"));
}
// deactivation/refresh languages button
if ($plugin["is_active"]) {
// refresh languages button
if (count($langs) > 0) {
$ilToolbar->addButton($lng->txt("cmps_refresh"), $ilCtrl->getLinkTarget($this, "refreshLanguages"));
}
// configure button
if (ilPlugin::hasConfigureClass($slot->getPluginsDirectory(), $plugin["name"]) && $ilCtrl->checkTargetClass(ilPlugin::getConfigureClassName($plugin["name"]))) {
$ilToolbar->addButton($lng->txt("cmps_configure"), $ilCtrl->getLinkTargetByClass(strtolower(ilPlugin::getConfigureClassName($plugin["name"])), "configure"));
}
// deactivate button
$ilToolbar->addButton($lng->txt("cmps_deactivate"), $ilCtrl->getLinkTarget($this, "deactivatePlugin"));
}
// update button
if ($plugin["needs_update"]) {
$ilToolbar->addButton($lng->txt("cmps_update"), $ilCtrl->getLinkTarget($this, "updatePlugin"));
}
// info
$resp = array();
if (strlen($plugin["responsible"])) {
$responsibles = explode('/', $plugin["responsible_mail"]);
foreach ($responsibles as $responsible) {
if (!strlen($responsible = trim($responsible))) {
continue;
}
$resp[] = $responsible;
}
$resp = $plugin["responsible"] . " (" . implode(" / ", $resp) . ")";
}
if ($plugin["is_active"]) {
$status = $lng->txt("cmps_active");
} else {
$r = $status["inactive_reason"] != "" ? " (" . $status["inactive_reason"] . ")" : "";
$status = $lng->txt("cmps_inactive") . $r;
}
$info[""][$lng->txt("cmps_name")] = $plugin["name"];
$info[""][$lng->txt("cmps_id")] = $plugin["id"];
$info[""][$lng->txt("cmps_version")] = $plugin["version"];
if ($resp) {
$info[""][$lng->txt("cmps_responsible")] = $resp;
}
$info[""][$lng->txt("cmps_ilias_min_version")] = $plugin["ilias_min_version"];
$info[""][$lng->txt("cmps_ilias_max_version")] = $plugin["ilias_max_version"];
$info[""][$lng->txt("cmps_status")] = $status;
if (sizeof($langs)) {
$lang_files = array();
foreach ($langs as $lang) {
$lang_files[] = $lang["file"];
}
$info[""][$lng->txt("cmps_languages")] = implode(", ", $lang_files);
} else {
$info[""][$lng->txt("cmps_languages")] = $lng->txt("cmps_no_language_file_available");
}
$info[$lng->txt("cmps_basic_files")]["plugin.php"] = $plugin["plugin_php_file_status"] ? $lng->txt("cmps_available") : $lng->txt("cmps_missing");
$info[$lng->txt("cmps_basic_files")][$lng->txt("cmps_class_file")] = ($plugin["class_file_status"] ? $lng->txt("cmps_available") : $lng->txt("cmps_missing")) . " (" . $plugin["class_file"] . ")";
//.........这里部分代码省略.........
示例3: fillRow
/**
* Standard Version of Fill Row. Most likely to
* be overwritten by derived class.
*/
protected function fillRow($a_set)
{
global $lng, $ilCtrl, $ilDB;
$ilCtrl->setParameter($this->parent_obj, "ctype", $_GET["ctype"]);
$ilCtrl->setParameter($this->parent_obj, "cname", $_GET["cname"]);
$ilCtrl->setParameter($this->parent_obj, "slot_id", $_GET["slot_id"]);
$ilCtrl->setParameter($this->parent_obj, "pname", $a_set["name"]);
// dbupdate
$file = ilPlugin::getDBUpdateScriptName($_GET["ctype"], $_GET["cname"], ilPluginSlot::lookupSlotName($_GET["ctype"], $_GET["cname"], $_GET["slot_id"]), $a_set["name"]);
if (@is_file($file)) {
include_once "./Services/Component/classes/class.ilPluginDBUpdate.php";
$dbupdate = new ilPluginDBUpdate($_GET["ctype"], $_GET["cname"], $_GET["slot_id"], $a_set["name"], $ilDB, true, "");
// update command
/* if ($dbupdate->getFileVersion() > $dbupdate->getCurrentVersion())
{
$this->tpl->setCurrentBlock("db_update_cmd");
$this->tpl->setVariable("TXT_UPDATE_DB",
$lng->txt("cmps_update_db"));
$this->tpl->setVariable("HREF_UPDATE_DB",
$ilCtrl->getLinkTarget($this->parent_obj, "updatePluginDB"));
$this->tpl->parseCurrentBlock();
}
*/
// db version
$this->tpl->setCurrentBlock("db_versions");
$this->tpl->setVariable("TXT_CURRENT_VERSION", $lng->txt("cmps_current_version"));
$this->tpl->setVariable("VAL_CURRENT_VERSION", $dbupdate->getCurrentVersion());
$this->tpl->setVariable("TXT_FILE_VERSION", $lng->txt("cmps_file_version"));
$this->tpl->setVariable("VAL_FILE_VERSION", $dbupdate->getFileVersion());
$this->tpl->parseCurrentBlock();
$this->tpl->setCurrentBlock("db_update");
$this->tpl->setVariable("DB_UPDATE_FILE", "dbupdate.php");
} else {
$this->tpl->setCurrentBlock("db_update");
$this->tpl->setVariable("DB_UPDATE_FILE", $lng->txt("cmps_no_db_update_file_available"));
}
$this->tpl->parseCurrentBlock();
// language files
$langs = ilPlugin::getAvailableLangFiles($this->slot->getPluginsDirectory() . "/" . $a_set["name"] . "/lang");
if (count($langs) == 0) {
$this->tpl->setCurrentBlock("lang");
$this->tpl->setVariable("VAL_LANG_FILE", $lng->txt("cmps_no_language_file_available"));
$this->tpl->parseCurrentBlock();
}
foreach ($langs as $lang) {
$this->tpl->setCurrentBlock("lang");
$this->tpl->setVariable("VAL_LANG_FILE", $lang["file"]);
$this->tpl->parseCurrentBlock();
}
// activation button
if ($a_set["activation_possible"]) {
$this->tpl->setCurrentBlock("activate");
$this->tpl->setVariable("HREF_ACTIVATE", $ilCtrl->getLinkTarget($this->parent_obj, "activatePlugin"));
$this->tpl->setVariable("TXT_ACTIVATE", $lng->txt("cmps_activate"));
$this->tpl->parseCurrentBlock();
}
// deactivation/refresh languages button
if ($a_set["is_active"]) {
// deactivate button
$this->tpl->setCurrentBlock("deactivate");
$this->tpl->setVariable("HREF_DEACTIVATE", $ilCtrl->getLinkTarget($this->parent_obj, "deactivatePlugin"));
$this->tpl->setVariable("TXT_DEACTIVATE", $lng->txt("cmps_deactivate"));
$this->tpl->parseCurrentBlock();
// refresh languages button
if (count($langs) > 0) {
$this->tpl->setCurrentBlock("refresh_langs");
$this->tpl->setVariable("HREF_REFRESH_LANGS", $ilCtrl->getLinkTarget($this->parent_obj, "refreshLanguages"));
$this->tpl->setVariable("TXT_REFRESH_LANGS", $lng->txt("cmps_refresh"));
$this->tpl->parseCurrentBlock();
}
// configure button
if (ilPlugin::hasConfigureClass($this->slot->getPluginsDirectory(), $a_set["name"]) && $ilCtrl->checkTargetClass(ilPlugin::getConfigureClassName($a_set["name"]))) {
$this->tpl->setCurrentBlock("configure");
$this->tpl->setVariable("HREF_CONFIGURE", $ilCtrl->getLinkTargetByClass(strtolower(ilPlugin::getConfigureClassName($a_set["name"])), "configure"));
$this->tpl->setVariable("TXT_CONFIGURE", $lng->txt("cmps_configure"));
$this->tpl->parseCurrentBlock();
}
}
// update button
if ($a_set["needs_update"]) {
$this->tpl->setCurrentBlock("update");
$this->tpl->setVariable("HREF_UPDATE", $ilCtrl->getLinkTarget($this->parent_obj, "updatePlugin"));
$this->tpl->setVariable("TXT_UPDATE", $lng->txt("cmps_update"));
$this->tpl->parseCurrentBlock();
}
if (strlen($a_set["responsible"])) {
$responsibles = explode('/', $a_set["responsible_mail"]);
$first_handled = false;
foreach ($responsibles as $responsible) {
if (!strlen($responsible = trim($responsible))) {
continue;
}
if ($first_handled) {
$this->tpl->touchBlock('plugin_responsible_sep');
}
$this->tpl->setCurrentBlock("plugin_responsible");
//.........这里部分代码省略.........