Example #1
0
    }
    $sqlNetwork .= ")\n";
    $sql = "SELECT user_id,username,account_origin,reg_date,account_status FROM users WHERE 1=1 {$sqlNetwork} ORDER BY {$sort} {$direction} LIMIT {$per_page} OFFSET {$offset}";
    $db->execSql($sql, $users_res, false);
    if ($users_res) {
        $smarty->assign("users_array", $users_res);
    } else {
        $smarty->assign("error", _('Internal error.'));
    }
    $smarty->assign("account_status_to_text", $account_status_to_text);
    // Display user selection form
    $html = "";
    $html .= "<fieldset class=\"pretty_fieldset\">";
    $html .= "<legend>" . _("Find a user ID : ") . "</legend>";
    $html .= "<form method='POST' action=''>\n";
    $html .= User::getSelectUserUI("user_id_searchbox") . "<br>\n";
    $html .= "<input type='submit'>\n";
    $html .= "</form><p>\n";
    $html .= "</fieldset>";
    $html .= $smarty->fetch("admin/templates/user_log.html");
    $ui = MainUI::getObject();
    $ui->addContent('main_area_middle', $html);
    $ui->display();
}
/*
 * Local variables:
 * tab-width: 4
 * c-basic-offset: 4
 * c-hanging-comment-ender-p: nil
 * End:
 */
Example #2
0
 /**
  * Retreives the admin interface of this object. Anything that overrides
  * this method should call the parent method with it's output at the END of
  * processing.
  * @param string $subclass_admin_interface HTML content of the interface
  * element of a children.
  * @return string The HTML fragment for this interface.
  */
 public function getAdminUI($subclass_admin_interface = null, $title = null)
 {
     $db = AbstractDb::getObject();
     $html = '';
     if (!(User::getCurrentUser()->DEPRECATEDisSuperAdmin() || $this->DEPRECATEDisOwner(User::getCurrentUser()))) {
         $html .= $this->getListUI();
         $html .= ' ' . _("(You do not have access to edit this piece of content)");
     } else {
         $html .= "<fieldset class='admin_container " . get_class($this) . "'>\n";
         if (!empty($title)) {
             $html .= "<legend>{$title}</legend>\n";
         }
         $html .= "<ul class='admin_element_list'>\n";
         if ($this->getObjectType() == 'Content') {
             // The object hasn't yet been typed.
             $html .= _("You must select a content type: ");
             $i = 0;
             foreach (self::getAvailableContentTypes() as $classname) {
                 $tab[$i][0] = $classname;
                 $tab[$i][1] = $classname;
                 $i++;
             }
             $html .= FormSelectGenerator::generateFromArray($tab, null, "content_" . $this->id . "_content_type", "Content", false);
         } else {
             $criteria_array = array(array('isSimpleContent'));
             $metadada_allowed_content_types = ContentTypeFilter::getObject($criteria_array);
             // Content metadata
             if ($this->isSimpleContent() == false || $this->isPersistent()) {
                 $html .= "<fieldset class='admin_element_group'>\n";
                 $html .= "<legend>" . sprintf(_("%s MetaData"), get_class($this)) . "</legend>\n";
                 /* title_is_displayed */
                 $html_title_is_displayed = _("Display the title?") . ": \n";
                 $name = "content_" . $this->id . "_title_is_displayed";
                 $this->titleShouldDisplay() ? $checked = 'CHECKED' : ($checked = '');
                 $html_title_is_displayed .= "<input type='checkbox' name='{$name}' {$checked}>\n";
                 /* title */
                 $html .= "<li class='admin_element_item_container admin_section_edit_title'>\n";
                 $html .= "<div class='admin_element_data'>\n";
                 if (empty($this->content_row['title'])) {
                     $html .= self::getNewContentUI("title_{$this->id}_new", $metadada_allowed_content_types, _("Title:"));
                     $html .= "</div>\n";
                 } else {
                     $html .= $html_title_is_displayed;
                     $title = self::getObject($this->content_row['title']);
                     $html .= $title->getAdminUI(null, _("Title:"));
                     $html .= "</div>\n";
                     $html .= "<div class='admin_element_tools admin_section_delete_title'>\n";
                     $name = "content_" . $this->id . "_title_erase";
                     $html .= "<input type='submit' class='submit' name='{$name}' value='" . sprintf(_("Delete %s (%s)"), _("title"), get_class($title)) . "'>";
                     $html .= "</div>\n";
                 }
                 $html .= "</li>\n";
             }
             if ($this->isSimpleContent() == false) {
                 /* description */
                 $html .= "<li class='admin_element_item_container admin_section_edit_description'>\n";
                 $html .= "<div class='admin_element_data'>\n";
                 if (empty($this->content_row['description'])) {
                     $html .= self::getNewContentUI("description_{$this->id}_new", $metadada_allowed_content_types, _("Description:"));
                     $html .= "</div>\n";
                 } else {
                     $description = self::getObject($this->content_row['description']);
                     $html .= $description->getAdminUI(null, _("Description:"));
                     $html .= "</div>\n";
                     $html .= "<div class='admin_element_tools'>\n";
                     $name = "content_" . $this->id . "_description_erase";
                     $html .= "<input type='submit' class='submit' name='{$name}' value='" . sprintf(_("Delete %s (%s)"), _("description"), get_class($description)) . "'>";
                     $html .= "</div>\n";
                 }
                 $html .= "</li>\n";
                 /* long description */
                 $html .= "<li class='admin_element_item_container admin_section_edit_long_description'>\n";
                 $html .= "<div class='admin_element_data'>\n";
                 if (empty($this->content_row['long_description'])) {
                     $html .= self::getNewContentUI("long_description_{$this->id}_new", $metadada_allowed_content_types, _("Long description:"));
                     $html .= "</div>\n";
                 } else {
                     $description = self::getObject($this->content_row['long_description']);
                     $html .= $description->getAdminUI(null, _("Long description:"));
                     $html .= "</div>\n";
                     $html .= "<div class='admin_element_tools'>\n";
                     $name = "content_" . $this->id . "_long_description_erase";
                     $html .= "<input type='submit' class='submit' name='{$name}' value='" . sprintf(_("Delete %s (%s)"), _("long description"), get_class($description)) . "'>";
                     $html .= "</div>\n";
                 }
                 $html .= "</li>\n";
                 /* project_info */
                 $html .= "<li class='admin_element_item_container admin_section_edit_project'>\n";
                 $html .= "<div class='admin_element_data'>\n";
                 if (empty($this->content_row['project_info'])) {
                     $html .= self::getNewContentUI("project_info_{$this->id}_new", $metadada_allowed_content_types, _("Information on this project:"));
                     $html .= "</div>\n";
                 } else {
                     $project_info = self::getObject($this->content_row['project_info']);
                     $html .= $project_info->getAdminUI(null, _("Information on this project:"));
                     $html .= "</div>\n";
                     $html .= "<div class='admin_element_tools'>\n";
                     $name = "content_" . $this->id . "_project_info_erase";
                     $html .= "<input type='submit' class='submit' name='{$name}' value='" . sprintf(_("Delete %s (%s)"), _("project information"), get_class($project_info)) . "'>";
                     $html .= "</div>\n";
                 }
                 $html .= "</li>\n";
             }
             //End content medatada
             if ($this->isSimpleContent() == false || $this->isPersistent()) {
                 $html .= "</fieldset>\n";
             }
             if ($this->isSimpleContent() == false || $this->isPersistent()) {
                 $html .= "<fieldset class='admin_element_group'>\n";
                 $html .= "<legend>" . sprintf(_("%s access control"), get_class($this)) . "</legend>\n";
                 /* is_persistent */
                 $html .= "<li class='admin_element_item_container admin_section_edit_persistant'>\n";
                 $html .= "<div class='admin_element_label'>" . _("Is part of reusable content library (protected from deletion)?") . ": </div>\n";
                 $html .= "<div class='admin_element_data'>\n";
                 $name = "content_" . $this->id . "_is_persistent";
                 $this->isPersistent() ? $checked = 'CHECKED' : ($checked = '');
                 $html .= "<input type='checkbox' name='{$name}' {$checked} onChange='submit();'>\n";
                 $html .= "</div>\n";
                 $html .= "</li>\n";
                 /* content_has_owners */
                 $html .= "<li class='admin_element_item_container content_has_owners'>\n";
                 $html .= "<div class='admin_element_label'>" . _("Content owner list") . "</div>\n";
                 $html .= "<ul class='admin_element_list'>\n";
                 $db = AbstractDb::getObject();
                 $sql = "SELECT * FROM content_has_owners WHERE content_id='{$this->id}'";
                 $db->execSql($sql, $content_owner_rows, false);
                 if ($content_owner_rows != null) {
                     foreach ($content_owner_rows as $content_owner_row) {
                         $html .= "<li class='admin_element_item_container'>\n";
                         $html .= "<div class='admin_element_data'>\n";
                         $user = User::getObject($content_owner_row['user_id']);
                         $html .= $user->getListUI();
                         $name = "content_" . $this->id . "_owner_" . $user->GetId() . "_is_author";
                         $html .= " Is content author? ";
                         $content_owner_row['is_author'] == 't' ? $checked = 'CHECKED' : ($checked = '');
                         $html .= "<input type='checkbox' name='{$name}' {$checked}>\n";
                         $html .= "</div>\n";
                         $html .= "<div class='admin_element_tools'>\n";
                         $name = "content_" . $this->id . "_owner_" . $user->GetId() . "_remove";
                         $html .= "<input type='submit' class='submit' name='{$name}' value='" . _("Remove owner") . "'>";
                         $html .= "</div>\n";
                         $html .= "</li>\n";
                     }
                 }
                 $html .= "<li class='admin_element_item_container'>\n";
                 $html .= "<div class='admin_element_data'>\n";
                 $add_button_name = "content_{$this->id}_add_owner_submit";
                 $add_button_value = _("Add owner");
                 $html .= User::getSelectUserUI("content_{$this->id}_new_owner", $add_button_name, $add_button_value);
                 $html .= "</div>\n";
                 $html .= "</li>\n";
                 $html .= "</ul>\n";
                 $html .= "</li>\n";
                 $html .= "</fieldset>\n";
             }
         }
         $html .= $subclass_admin_interface;
         $html .= "</ul>\n";
         $html .= "</fieldset>\n";
     }
     return $html;
 }
Example #3
0
 /**
  * Retrieves the interface to assign stakeholders to objects
  *
  * @return string The HTML fragment for this interface
  *
  * @param $targetObject The Object on which the permssion applies (Network, Server, etc.)
  */
 public static function getAssignStakeholdersUI($targetObject)
 {
     require_once 'classes/Role.php';
     if (User::getCurrentUser()->DEPRECATEDisSuperAdmin()) {
         $listData = "";
         $db = AbstractDb::getObject();
         $object_class = get_class($targetObject);
         $table = strtolower($object_class) . '_stakeholders';
         $object_id = $db->escapeString($targetObject->getId());
         $sql = "SELECT * FROM {$table} JOIN roles USING (role_id) WHERE object_id = '{$object_id}';";
         $stakeholder_rows = null;
         $db->execSql($sql, $stakeholder_rows, false);
         if ($stakeholder_rows) {
             foreach ($stakeholder_rows as $stakeholder_row) {
                 $user = User::getObject($stakeholder_row['user_id']);
                 $role = Role::getObject($stakeholder_row['role_id']);
                 $roleStr = htmlspecialchars($role->getLabelStr());
                 $name = $object_id . "_stakeholder_" . $stakeholder_row['user_id'] . "_" . $stakeholder_row['role_id'] . "_remove";
                 $listDataContents = InterfaceElements::generateAdminSection("", $user->getListUI() . ' ' . $roleStr, InterfaceElements::generateInputSubmit($name, _("Remove stakeholder")));
                 $listData .= "<li class='admin_element_item_container node_owner_list'>" . $listDataContents . "</li>\n";
             }
         }
         $listData .= "<li class='admin_element_item_container'>";
         $listData .= Role::getSelectUI($object_id . "_new_stakeholder_role", array('stakeholderTypeId' => $object_class));
         $listData .= User::getSelectUserUI($object_id . "_new_stakeholder", $object_id . "_new_stakeholder_submit", _("Add stakeholder"));
         $listData .= "<br class='clearbr' /></li>\n";
         $html = "<ul id='node_owner_ul' class='admin_element_list'>\n" . $listData . "</ul>\n";
     }
     return $html;
 }