本文整理汇总了PHP中ilUtil::array_php2js方法的典型用法代码示例。如果您正苦于以下问题:PHP ilUtil::array_php2js方法的具体用法?PHP ilUtil::array_php2js怎么用?PHP ilUtil::array_php2js使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ilUtil
的用法示例。
在下文中一共展示了ilUtil::array_php2js方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __showSearchGroupTable
public function __showSearchGroupTable($a_result_set, $a_grp_ids = NULL)
{
$tbl =& $this->__initTableGUI();
$tpl =& $tbl->getTemplateObject();
$tpl->setCurrentBlock("tbl_form_header");
$tpl->setVariable("FORMACTION", $this->ctrl->getFormAction($this));
$tpl->parseCurrentBlock();
$tpl->setCurrentBlock("tbl_action_btn");
$tpl->setVariable("BTN_NAME", "searchUserForm");
$tpl->setVariable("BTN_VALUE", $this->lng->txt("back"));
$tpl->parseCurrentBlock();
$tpl->setCurrentBlock("tbl_action_btn");
$tpl->setVariable("BTN_NAME", "listUsersGroup");
$tpl->setVariable("BTN_VALUE", $this->lng->txt("grp_list_users"));
$tpl->parseCurrentBlock();
if (!empty($a_grp_ids)) {
// set checkbox toggles
$tpl->setCurrentBlock("tbl_action_toggle_checkboxes");
$tpl->setVariable("JS_VARNAME", "group");
$tpl->setVariable("JS_ONCLICK", ilUtil::array_php2js($a_grp_ids));
$tpl->setVariable("TXT_CHECKALL", $this->lng->txt("check_all"));
$tpl->setVariable("TXT_UNCHECKALL", $this->lng->txt("uncheck_all"));
$tpl->parseCurrentBlock();
}
$tpl->setCurrentBlock("tbl_action_row");
$tpl->setVariable("COLUMN_COUNTS", 5);
$tpl->setVariable("IMG_ARROW", ilUtil::getImagePath("arrow_downright.png"));
$tpl->parseCurrentBlock();
$tbl->setTitle($this->lng->txt("ilinc_header_edit_users"), "icon_usr_b.png", $this->lng->txt("ilinc_header_edit_users"));
$tbl->setHeaderNames(array("", $this->lng->txt("obj_grp"), $this->lng->txt("grp_count_members")));
$tbl->setHeaderVars(array("", "title", "nr_members"), array("ref_id" => $this->object->getRefId(), "cmd" => "search", "cmdClass" => "ilobjilinccoursegui", "cmdNode" => $_GET["cmdNode"]));
$tbl->setColumnWidth(array("", "80%", "19%"));
$this->__setTableGUIBasicData($tbl, $a_result_set, "group");
$tbl->render();
$this->tpl->setVariable("SEARCH_RESULT_TABLE", $tbl->tpl->get());
return true;
}
示例2: editPublicSection
function editPublicSection()
{
global $ilTabs, $ilToobar, $ilAccess;
if (!$ilAccess->checkAccessOfUser(ANONYMOUS_USER_ID, "read", "", $this->object->getRefId())) {
ilUtil::sendInfo($this->lng->txt("cont_anonymous_user_missing_perm"));
}
$this->setTabs();
$this->setSubTabs("public_section");
$ilTabs->setTabActive("settings");
switch ($this->object->getType()) {
case "lm":
$gui_class = "ilobjlearningmodulegui";
break;
case "dlb":
$gui_class = "ilobjdlbookgui";
break;
}
$this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.lm_public_selector.html", "Modules/LearningModule");
// get learning module object
$this->lm_obj = new ilObjLearningModule($this->ref_id, true);
// public mode
$my_toolbar = new ilToolbarGUI();
$modes = array("complete" => $this->lng->txt("all_pages"), "selected" => $this->lng->txt("selected_pages_only"));
include_once "./Services/Form/classes/class.ilSelectInputGUI.php";
$si = new ilSelectInputGUI($this->lng->txt("choose_public_mode"), "lm_public_mode");
$si->setOptions($modes);
$si->setValue($this->object->getPublicAccessMode());
$my_toolbar->addInputItem($si, true);
$my_toolbar->setOpenFormTag(false);
$my_toolbar->setCloseFormTag(false);
$my_toolbar->addFormButton($this->lng->txt("save"), "savePublicSection");
$this->tpl->setVariable("TOOLBAR", $my_toolbar->getHTML());
$this->tpl->setVariable("FORMACTION", $this->ctrl->getLinkTarget($this, "savePublicSection"));
if ($this->object->getPublicAccessMode() == "selected") {
$this->tpl->setCurrentBlock("select_pages");
require_once "./Modules/LearningModule/classes/class.ilPublicSectionSelector.php";
$exp = new ilPublicSectionSelector($this->ctrl->getLinkTarget($this, "view"), $this->object, $gui_class);
$exp->setTargetGet("obj_id");
// build html-output
$exp->setOutput(0);
$output = $exp->getOutput();
// get page ids
foreach ($exp->format_options as $node) {
if (!$node["container"]) {
$pages[] = $node["child"];
}
}
$js_pages = ilUtil::array_php2js($pages);
$this->tpl->setVariable("EXPLORER", $output);
$this->tpl->setVariable("ONCLICK", $js_pages);
$this->tpl->setVariable("TXT_CHECKALL", $this->lng->txt("check_all"));
$this->tpl->setVariable("TXT_UNCHECKALL", $this->lng->txt("uncheck_all"));
$this->tpl->setVariable("TXT_SAVE", $this->lng->txt("save"));
$this->tpl->parseCurrentBlock();
}
}
示例3: formatObject
/**
* Creates output
* recursive method
* @access private
* @param integer
* @param array
* @return string
*/
function formatObject(&$tpl, $a_node_id, $a_option, $a_obj_id = 0)
{
global $lng;
if (!isset($a_node_id) or !is_array($a_option)) {
$this->ilias->raiseError(get_class($this) . "::formatObject(): Missing parameter or wrong datatype! " . "node_id: " . $a_node_id . " options:" . var_dump($a_option), $this->ilias->error_obj->WARNING);
}
if ($this->output_icons) {
$tpl->setCurrentBlock("icon");
$tpl->setVariable("ICON_IMAGE", ilUtil::getImagePath("icon_" . $a_option["type"] . ".png"));
$tpl->setVariable("PAGE_ID", $a_node_id);
//$this->iconList[] = "iconid_".$a_node_id;
$tpl->setVariable("TXT_ALT_IMG", $lng->txt($a_option["desc"]));
$tpl->parseCurrentBlock();
}
if (!$a_option["container"]) {
$tpl->setCurrentBlock("checkbox");
$tpl->setVariable("PAGE_ID", $a_node_id);
if (ilLMObject::_isPagePublic($a_node_id)) {
$tpl->setVariable("CHECKED", "checked=\"checked\"");
}
$tpl->parseCurrentBlock();
} else {
$childs = $this->tree->getChilds($a_node_id);
foreach ($childs as $node) {
if ($node["type"] == "pg") {
$pages[] = $node["child"];
}
}
$js_pages = ilUtil::array_php2js($pages);
$tpl->setVariable("ONCLICK", " onclick=\"alterCheckboxes('PublicSelector','page_',{$js_pages}); return false;\"");
}
$tpl->setCurrentBlock("text");
$tpl->setVariable("PAGE_ID", $a_node_id);
$tpl->setVariable("OBJ_TITLE", ilUtil::shortenText($a_option["title"], $this->textwidth, true));
$tpl->parseCurrentBlock();
$tpl->setCurrentBlock("element");
$tpl->parseCurrentBlock();
//$this->output[] = $tpl->get();
}
示例4: permObject
//.........这里部分代码省略.........
if ($par["obj_id"] != SYSTEM_ROLE_ID) {
$radio = ilUtil::formRadioButton(0, "adopt", $par["obj_id"]);
$output["adopt"][$key]["css_row_adopt"] = ilUtil::switchColor($key, "tblrow1", "tblrow2");
$output["adopt"][$key]["check_adopt"] = $radio;
$output["adopt"][$key]["type"] = $par["type"] == 'role' ? 'Role' : 'Template';
$output["adopt"][$key]["role_name"] = $par["title"];
}
}
$output["formaction_adopt"] = $this->ctrl->getFormAction($this);
// END ADOPT_PERMISSIONS
}
$output["formaction"] = $this->ctrl->getFormAction($this);
$this->data = $output;
/************************************/
/* generate output */
/************************************/
$this->tpl->addBlockFile("CONTENT", "content", "tpl.adm_content.html");
$this->tpl->addBlockFile("LOCATOR", "locator", "tpl.locator.html", "Services/Locator");
$this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.adm_perm_role.html", "Services/AccessControl");
foreach ($rbac_objects as $obj_data) {
// BEGIN object_operations
$this->tpl->setCurrentBlock("object_operations");
foreach ($obj_data["ops"] as $operation) {
$ops_ids[] = $operation["ops_id"];
$css_row = ilUtil::switchColor($key, "tblrow1", "tblrow2");
$this->tpl->setVariable("CSS_ROW", $css_row);
$this->tpl->setVariable("PERMISSION", $operation["name"]);
$this->tpl->setVariable("CHECK_PERMISSION", $this->data["perm"][$obj_data["obj_id"]][$operation["ops_id"]]);
$this->tpl->parseCurrentBlock();
}
// END object_operations
// BEGIN object_type
$this->tpl->setCurrentBlock("object_type");
$this->tpl->setVariable("TXT_OBJ_TYPE", $obj_data["name"]);
// TODO: move this if in a function and query all objects that may be disabled or inactive
if ($this->objDefinition->getDevMode($obj_data["type"])) {
$this->tpl->setVariable("TXT_NOT_IMPL", "(" . $this->lng->txt("not_implemented_yet") . ")");
} else {
if ($obj_data["type"] == "icrs" and !$this->ilias->getSetting("ilinc_active")) {
$this->tpl->setVariable("TXT_NOT_IMPL", "(" . $this->lng->txt("not_enabled_or_configured") . ")");
}
}
// js checkbox toggles
$this->tpl->setVariable("JS_VARNAME", "template_perm_" . $obj_data["type"]);
$this->tpl->setVariable("JS_ONCLICK", ilUtil::array_php2js($ops_ids));
$this->tpl->setVariable("TXT_CHECKALL", $this->lng->txt("check_all"));
$this->tpl->setVariable("TXT_UNCHECKALL", $this->lng->txt("uncheck_all"));
$this->tpl->parseCurrentBlock();
// END object_type
}
/*
// BEGIN ADOPT PERMISSIONS
foreach ($this->data["adopt"] as $key => $value)
{
$this->tpl->setCurrentBlock("ADOPT_PERM_ROW");
$this->tpl->setVariable("CSS_ROW_ADOPT",$value["css_row_adopt"]);
$this->tpl->setVariable("CHECK_ADOPT",$value["check_adopt"]);
$this->tpl->setVariable("TYPE",$value["type"]);
$this->tpl->setVariable("ROLE_NAME",$value["role_name"]);
$this->tpl->parseCurrentBlock();
}
$this->tpl->setCurrentBlock("ADOPT_PERM_FORM");
$this->tpl->setVariable("MESSAGE_MIDDLE",$this->data["message_middle"]);
$this->tpl->setVariable("FORMACTION_ADOPT",$this->data["formaction_adopt"]);
$this->tpl->setVariable("ADOPT",$this->lng->txt('copy'));
$this->tpl->parseCurrentBlock();
// END ADOPT PERMISSIONS
*/
$this->tpl->setCurrentBlock("tblfooter_protected");
$this->tpl->setVariable("COL_ANZ", 3);
$this->tpl->setVariable("CHECK_BOTTOM", $this->data["check_protected"]);
$this->tpl->setVariable("MESSAGE_TABLE", $this->data["text_protected"]);
$this->tpl->parseCurrentBlock();
$this->tpl->setVariable("COL_ANZ_PLUS", 4);
$this->tpl->setVariable("TXT_SAVE", $this->data["txt_save"]);
$this->tpl->setCurrentBlock("adm_content");
$this->tpl->setVariable("TBL_TITLE_IMG", ilUtil::getImagePath("icon_" . $this->object->getType() . ".png"));
$this->tpl->setVariable("TBL_TITLE_IMG_ALT", $this->lng->txt($this->object->getType()));
$this->tpl->setVariable("TBL_HELP_IMG", ilUtil::getImagePath("icon_help.png"));
$this->tpl->setVariable("TBL_HELP_LINK", "tbl_help.php");
$this->tpl->setVariable("TBL_HELP_IMG_ALT", $this->lng->txt("help"));
// compute additional information in title
if (substr($this->object->getTitle(), 0, 3) == "il_") {
$desc = $this->lng->txt("predefined_template");
//$this->lng->txt("obj_".$parent_node['type'])." (".$parent_node['obj_id'].") : ".$parent_node['title'];
}
$description = "<br/> <span class=\"small\">" . $desc . "</span>";
// translation for autogenerated roles
if (substr($this->object->getTitle(), 0, 3) == "il_") {
include_once './Services/AccessControl/classes/class.ilObjRole.php';
$title = ilObjRole::_getTranslation($this->object->getTitle()) . " (" . $this->object->getTitle() . ")";
} else {
$title = $this->object->getTitle();
}
$this->tpl->setVariable("TBL_TITLE", $title . $description);
$this->tpl->setVariable("TXT_PERMISSION", $this->data["txt_permission"]);
$this->tpl->setVariable("FORMACTION", $this->data["formaction"]);
$this->tpl->parseCurrentBlock();
}
示例5: fbList
/**
* List all feedback items.
*/
function fbList()
{
include_once 'Services/Feedback/classes/class.ilFeedback.php';
$tbl =& $this->__initTableGUI();
$cnt = 0;
$ilFeedback = new ilFeedback();
$ilFeedback->setRefId($_GET['ref_id']);
$barometers = $ilFeedback->getAllBarometer();
if (is_Array($barometers)) {
foreach ($barometers as $barometer) {
$rows[$cnt]['checkbox'] = ilUtil::formCheckbox(0, "barometer[]", $barometer->getId());
$rows[$cnt]['title'] = $barometer->getTitle();
$rows[$cnt]['status'] = 'Aktive';
if ($barometer->getStarttime() > 0 && $barometer->getStarttime() > 0) {
$rows[$cnt]['running'] = date('d.m.Y H:i', $barometer->getStarttime()) . ' - ' . date('d.m.Y H:i', $barometer->getEndtime());
if ($barometer->getStarttime() <= time() && $barometer->getEndtime() >= time()) {
$rows[$cnt]['status'] = $this->lng->txt('active');
} else {
$rows[$cnt]['status'] = $this->lng->txt('inactive');
}
} else {
$rows[$cnt]['running'] = '';
$rows[$cnt]['status'] = $this->lng->txt('active');
}
$rows[$cnt]['options'] = $this->getButtons($barometer->getId());
$barometer_ids[] = $barometer->getId();
$cnt++;
}
}
$tbl->tpl->setCurrentBlock("tbl_form_header");
$tbl->tpl->setVariable("FORMACTION", $this->ctrl->getFormAction($this));
$tbl->tpl->parseCurrentBlock();
$tbl->setTitle($this->lng->txt("feedb_feedback_list"), "icon_feedb.png", $this->lng->txt("feedb_feedback_list"));
$tbl->setHeaderNames(array("", $this->lng->txt("title"), $this->lng->txt("status"), $this->lng->txt("time"), $this->lng->txt("options")));
$tbl->setHeaderVars(array("checkbox", "title", "stauts", "running", "options"));
$tbl->setData($rows);
$tbl->setOffset(0);
$tbl->setLimit(0);
$tbl->disable('sort');
$tbl->setMaxCount(count($rows));
/* deprecated - will be removed in 4.4
$tbl->tpl->setCurrentBlock("plain_button");
$tbl->tpl->setVariable("PBTN_NAME","addBarometer");
$tbl->tpl->setVariable("PBTN_VALUE",$this->lng->txt("barometer_add"));
$tbl->tpl->parseCurrentBlock();
$tbl->tpl->setCurrentBlock("plain_buttons");
$tbl->tpl->parseCurrentBlock();
*/
if (!empty($rows)) {
// set checkbox toggles
$tbl->tpl->setCurrentBlock("tbl_action_toggle_checkboxes");
$tbl->tpl->setVariable("JS_VARNAME", "barometer");
$tbl->tpl->setVariable("JS_ONCLICK", ilUtil::array_php2js($barometer_ids));
$tbl->tpl->setVariable("TXT_CHECKALL", $this->lng->txt("check_all"));
$tbl->tpl->setVariable("TXT_UNCHECKALL", $this->lng->txt("uncheck_all"));
$tbl->tpl->parseCurrentBlock();
}
$tbl->tpl->setVariable("COLUMN_COUNTS", 5);
$tbl->tpl->setVariable("IMG_ARROW", ilUtil::getImagePath("arrow_downright.png"));
$tbl->tpl->setCurrentBlock("tbl_action_select");
//$tbl->tpl->setVariable("SELECT_ACTION",ilUtil::formSelect(1,"action",array('delete'),false,true));
$tbl->tpl->setVariable("BTN_NAME", "delete");
$tbl->tpl->setVariable("BTN_VALUE", $this->lng->txt("delete"));
$tbl->tpl->parseCurrentBlock();
//$tbl->setOrderColumn('title');
$tbl->setOrderDirection('asc');
$tbl->setColumnWidth(array("", "25%", "25%", "25%", ""));
#$tbl->disable('sort');
$tbl->setFooter("tblfooter");
$tbl->render();
return $tbl->tpl->get();
}
示例6: __showPermissionsCreateSection
function __showPermissionsCreateSection()
{
global $objDefinition, $ilSetting;
// no create operation for roles/role templates in local role folders
// access is controlled by 'administrate' (change permission settings) only
if ($this->gui_obj->object->getType() == 'rolf' and $this->gui_obj->object->getRefId() != ROLE_FOLDER_ID) {
return;
}
// create pointer to first role (only the permission list is needed)
reset($this->roles);
$first_role =& current($this->roles);
if (count($first_role['permissions']['create'])) {
$this->tpl->setCurrentBlock("perm_subtitle");
$this->tpl->setVariable("TXT_PERM_CLASS", $this->lng->txt('perm_class_create'));
$this->tpl->setVariable("TXT_PERM_CLASS_DESC", $this->lng->txt('perm_class_create_desc'));
$this->tpl->setVariable("COLSPAN", $this->num_roles);
$this->tpl->parseCurrentBlock();
// add a checkbox 'select all' for create permissions of the following object types
$container_arr = array('cat', 'grp', 'crs', 'fold');
if (in_array($this->gui_obj->object->getType(), $container_arr)) {
$chk_toggle_create = true;
}
foreach ($this->roles as $role) {
$ops_ids = array();
foreach ($role['permissions']['create'] as $perm) {
$ops_ids[] = $perm['ops_id'];
}
if ($chk_toggle_create) {
$this->tpl->setCurrentBlock('chk_toggle_create');
$this->tpl->setVariable('PERM_NAME', $this->lng->txt('check_all') . "/" . $this->lng->txt('uncheck_all'));
$this->tpl->setVariable('PERM_TOOLTIP', $this->lng->txt('check_all'));
$this->tpl->setVariable('ROLE_ID', $role['obj_id']);
$this->tpl->setVariable('JS_VARNAME', 'perm_' . $role['obj_id']);
$this->tpl->setVariable('JS_ONCLICK', ilUtil::array_php2js($ops_ids));
$this->tpl->parseCurrentBlock();
}
foreach ($role['permissions']['create'] as $perm) {
if ($perm["name"] == "create_icrs" and !$ilSetting->get("ilinc_active")) {
continue;
}
$box = ilUtil::formCheckBox($perm['checked'], "perm[" . $role["obj_id"] . "][]", $perm["ops_id"], $role["protected"]);
$this->tpl->setCurrentBlock("perm_item");
$this->tpl->setVariable("PERM_CHECKBOX", $box);
if ($objDefinition->isPlugin(substr($perm['name'], 7))) {
$this->tpl->setVariable("PERM_NAME", ilPlugin::lookupTxt("rep_robj", substr($perm['name'], 7), "obj_" . substr($perm['name'], 7)));
$this->tpl->setVariable("PERM_TOOLTIP", ilPlugin::lookupTxt("rep_robj", substr($perm['name'], 7), $this->gui_obj->object->getType() . "_" . $perm['name']));
} else {
$this->tpl->setVariable("PERM_NAME", $this->lng->txt("obj" . substr($perm['name'], 6)));
$this->tpl->setVariable("PERM_TOOLTIP", $this->lng->txt($this->gui_obj->object->getType() . "_" . $perm['name']));
}
$this->tpl->setVariable("PERM_LABEL", 'perm_' . $role['obj_id'] . '_' . $perm['ops_id']);
$this->tpl->parseCurrentBlock();
}
$this->tpl->setCurrentBlock("perm_table");
$this->tpl->parseCurrentBlock();
}
$this->tpl->setCurrentBlock("perm_settings");
$this->tpl->parseCurrentBlock();
}
}
示例7: __showRolesTable
function __showRolesTable($a_result_set, $a_role_ids = NULL)
{
global $rbacsystem;
$actions = array("assignSave" => $this->lng->txt("change_assignment"));
$tbl =& $this->__initTableGUI();
$tpl =& $tbl->getTemplateObject();
$tpl->setCurrentBlock("tbl_form_header");
$tpl->setVariable("FORMACTION", $this->ctrl->getFormAction($this));
$tpl->parseCurrentBlock();
$tpl->setCurrentBlock("tbl_action_row");
$tpl->setVariable("COLUMN_COUNTS", 4);
$tpl->setVariable("IMG_ARROW", ilUtil::getImagePath("arrow_downright.png"));
foreach ($actions as $name => $value) {
$tpl->setCurrentBlock("tbl_action_btn");
$tpl->setVariable("BTN_NAME", $name);
$tpl->setVariable("BTN_VALUE", $value);
$tpl->parseCurrentBlock();
}
if (!empty($a_role_ids)) {
// set checkbox toggles
$tpl->setCurrentBlock("tbl_action_toggle_checkboxes");
$tpl->setVariable("JS_VARNAME", "role_id");
$tpl->setVariable("JS_ONCLICK", ilUtil::array_php2js($a_role_ids));
$tpl->setVariable("TXT_CHECKALL", $this->lng->txt("check_all"));
$tpl->setVariable("TXT_UNCHECKALL", $this->lng->txt("uncheck_all"));
$tpl->parseCurrentBlock();
}
$tpl->setVariable("TPLPATH", $this->tpl->tplPath);
$this->ctrl->setParameter($this, "cmd", "roleassignment");
// title & header columns
$tbl->setTitle($this->lng->txt("edit_roleassignment"), "icon_role.png", $this->lng->txt("roles"));
//user must be administrator
$tbl->setHeaderNames(array("", $this->lng->txt("role"), $this->lng->txt("description"), $this->lng->txt("context")));
$tbl->setHeaderVars(array("", "title", "description", "context"), $this->ctrl->getParameterArray($this, "", false));
$tbl->setColumnWidth(array("", "30%", "40%", "30%"));
$this->__setTableGUIBasicData($tbl, $a_result_set, "roleassignment");
$tbl->render();
$this->tpl->setVariable("ROLES_TABLE", $tbl->tpl->get());
return true;
}