Exemplo n.º 1
0
function modforumaccess_old()
{
    checkPerm('mod');
    require_once _adm_ . "/lib/lib.simplesel.php";
    $out =& $GLOBALS['page'];
    $out->setWorkingZone("content");
    $lang =& DoceboLanguage::createInstance('public_forum', 'lms');
    $idForum = (int) importVar("idForum");
    $ssel = new SimpleSelector(true, $lang);
    $perm = array();
    $perm["view"]["img"] = getPathImage() . "standard/view.png";
    $perm["view"]["alt"] = $lang->def("_VIEW");
    $perm["write"]["img"] = getPathImage() . "standard/reply.png";
    $perm["write"]["alt"] = $lang->def("_ADD");
    $perm["upload"]["img"] = getPathImage() . "standard/download.png";
    $perm["upload"]["alt"] = $lang->def("_ALT_UPLOAD");
    /*$perm["add"]["img"] = getPathImage()."standard/add.png";
    	$perm["add"]["alt"] = $lang->def("_ADD");
    	$perm["mod"]["img"] = getPathImage()."standard/edit.png";
    	$perm["mod"]["alt"] = $lang->def("_MOD");
    	$perm["del"]["img"] = getPathImage()."standard/delete.png";
    	$perm["del"]["alt"] = $lang->def("_DEL");*/
    $perm["moderate"]["img"] = '';
    $perm["moderate"]["alt"] = $lang->def("_MODERATE");
    $ssel->setPermList($perm);
    $url = "index.php?modname=public_forum&op=modforumaccess&idForum=" . $idForum;
    $back_url = "index.php?modname=public_forum&op=forum";
    $ssel->setLinks($url, $back_url);
    $op = $ssel->getOp();
    if ($op == "main" || $op == "manual_init" || $op == "orgchartselector") {
        $saved_data = loadForumSavedPerm($idForum);
    }
    $page_body = "";
    $full_page = "";
    switch ($op) {
        case "main":
            $ssel->setSavedData($saved_data);
            $page_body = $ssel->loadSimpleSelector(false, true);
            break;
        case "manual_init":
            // Saving permissions of simple selector
            $save_info = $ssel->getSaveInfo();
            saveForumPerm($idForum, $save_info["selected"], $save_info["database"]);
            $ssel->setSavedData($saved_data);
            $full_page = $ssel->loadManualSelector($lang->def('_FORUM_PERM'));
            break;
        case "manual":
            $full_page = $ssel->loadManualSelector($lang->def('_FORUM_PERM'));
            break;
        case "save_manual":
            // Saving permissions of manual selector
            $save_info = $ssel->getSaveInfo();
            saveForumPerm($idForum, $save_info["selected"], $save_info["database"]);
            Util::jump_to(str_replace("&", "&", $url));
            break;
        case "save":
            // Saving permissions of simple selector
            $save_info = $ssel->getSaveInfo();
            saveForumPerm($idForum, $save_info["selected"], $save_info["database"]);
            Util::jump_to(str_replace("&", "&", $back_url));
            break;
        case 'orgchartselector':
            $ssel->setSavedData($saved_data);
            $page_body = $ssel->orgchartSelector();
            break;
        case 'save_org':
            $save_info = $ssel->getSaveInfoOrg();
            saveForumPerm($idForum, $save_info["selected"], $save_info["database"]);
            Util::jump_to(str_replace("&", "&", $back_url));
            break;
    }
    if (!empty($full_page)) {
        $out->add($full_page);
    }
    if (!empty($page_body)) {
        // If we have only the page body, then better to add the area title.
        $ta_array = array();
        $ta_array["index.php?modname=public_forum&op=forum"] = $lang->def("_FORUM");
        $ta_array[] = $lang->def('_FORUM_PERM');
        $out->add(getTitleArea($ta_array, 'forum', $lang->def('_FORUM')));
        $out->add("<div class=\"std_block\">");
        $out->add($page_body);
        $out->add("</div>");
    }
}
Exemplo n.º 2
0
 function showWikiPerm($wiki_id)
 {
     $res = FALSE;
     require_once _adm_ . "/lib/lib.simplesel.php";
     $um =& UrlManager::getInstance();
     $ssel = new SimpleSelector(TRUE, $this->lang);
     $perm = array();
     $perm["view"]["img"] = getPathImage('fw') . "standard/view.png";
     $perm["view"]["alt"] = $this->lang->def("_VIEW");
     $perm["edit"]["img"] = getPathImage('fw') . "standard/edit.png";
     $perm["edit"]["alt"] = $this->lang->def("_MOD");
     $ssel->setPermList($perm);
     $url = $um->getUrl("op=setperm&wiki_id=" . $wiki_id);
     $back_url = $um->getUrl("op=doneperm");
     $ssel->setLinks($url, $back_url);
     $op = $ssel->getOp();
     if ($op == "main" || $op == "manual_init") {
         $saved_data = $this->wikiManager->loadWikiPerm($wiki_id);
     }
     $page_body = "";
     $full_page = "";
     switch ($op) {
         case "main":
             $ssel->setSavedData($saved_data);
             $res = $ssel->loadSimpleSelector();
             break;
         case "manual_init":
             // Saving permissions of simple selector
             $save_info = $ssel->getSaveInfo();
             $this->wikiManager->saveWikiPerm($wiki_id, $save_info["selected"], $save_info["database"]);
             $ssel->setSavedData($saved_data);
             $ssel->loadManualSelector($this->lang->def("_ALT_SETPERM"));
             break;
         case "manual":
             $ssel->loadManualSelector($this->lang->def("_ALT_SETPERM"));
             break;
         case "save_manual":
             // Saving permissions of manual selector
             $save_info = $ssel->getSaveInfo();
             $this->wikiManager->saveWikiPerm($wiki_id, $save_info["selected"], $save_info["database"]);
             Util::jump_to(str_replace("&amp;", "&", $url));
             break;
         case "save":
             // Saving permissions of simple selector
             $save_info = $ssel->getSaveInfo();
             $this->wikiManager->saveWikiPerm($wiki_id, $save_info["selected"], $save_info["database"]);
             Util::jump_to(str_replace("&amp;", "&", $back_url));
             break;
     }
     return $res;
 }