} if (!isset($_POST['limit'])) { $_POST['limit'] = PAGE_SIZE; } if (!isset($_POST['data'])) { $_POST['data'] = ""; } $start = $_POST["start"]; $count = $_POST["limit"]; //Para eliminar grupos if (isset($_POST['DeleteGroupData'])) { //se decodifica el json en un array y hacemos each para recorrer los roles que desea eliminar el usuario $delete_items = json_decode($_POST['DeleteGroupData'], true); $ari->db->StartTrans(); foreach ($delete_items as $id_grupo) { $grupo = new seguridad_group($id_grupo['id']); $grupo->delete(); } if ($ari->db->CompleteTrans()) { $ari->clearCache(); } } //FILTRO POR COLUMNAS $where = ""; if ($_POST['data'] != "") { $filtros = admin_session_state::cache_filters(json_decode($_POST['data'], true)); $operadores = array(); $operadores["eq"] = "="; $operadores["lt"] = "<"; $operadores["gt"] = ">"; foreach ($filtros as $filtro) {
/** Returs the users on the system. status = (enabled/deleted/pending/bloqued/all) shows users search by $text in id, uname and email fields */ public static function search($status = USED, $sort = 'uname', $text = "", $pos = 0, $limit = 20, $operator = OPERATOR_EQUAL) { global $ari; //status if ($status == "all") { $estado = ""; } else { $estado = "AND status {$operator} '" . $status . "'"; } //search text $searchText = ""; if ($text != "") { $searchText = " {$text} "; } //sort by if (in_array($sort, seguridad_group::getOrders())) { $sortby = "ORDER BY {$sort}"; } else { $sortby = "ORDER BY name"; } $savem = $ari->db->SetFetchMode(ADODB_FETCH_NUM); $sql = "SELECT id FROM security_group WHERE 1=1 {$estado} {$searchText} {$sortby} "; $rs = $ari->db->SelectLimit($sql, $limit, $pos); $ari->db->SetFetchMode($savem); if ($rs && !$rs->EOF) { while (!$rs->EOF) { //@optimize => patron factory $return[] = new seguridad_group($rs->fields[0]); $rs->MoveNext(); } $rs->Close(); } else { return false; } return $return; }
include_once 'PhpExt/Data/JsonReader.php'; include_once 'PhpExt/Panel.php'; include_once 'PhpExt/Layout/AbsoluteLayout.php'; include_once 'PhpExt/Layout/FormLayoutData.php'; include_once 'PhpExt/Layout/AnchorLayoutData.php'; include_once 'PhpExt/Layout/FormLayout.php'; include_once 'PhpExt/Form/TextArea.php'; include_once 'PhpExt/Data/FieldConfigObject.php'; include_once 'PhpExtUx/Multiselect/Itemselector.php'; include_once 'PhpExt/Data/JsonStore.php'; include_once 'PhpExtUx/App/SearchField.php'; global $ari; $ari->popup = 1; // no mostrar el main_frame if (isset($_POST['id'])) { $grupo = new seguridad_group($_POST['id']); } else { throw new OOB_Exception_400("La variable [id] no esta definida"); } $field_width = 180; //ancho de los controles PhpExt_Javascript::sendContentType(); $grid_id = ''; if (isset($_POST['gid'])) { $grid_id = $_POST['gid']; } $page_size = PAGE_SIZE; //controles //nombre del grupo $txt_nombre = PhpExt_Form_TextField::createTextField("txt_nombre", "Nombre")->setWidth($field_width)->setMsgTarget(PhpExt_Form_FormPanel::MSG_TARGET_SIDE)->setValue($grupo->get("name")); //descripcion del grupo
<?php //codigo por jpcoseani //script que devuelve el listado de usuarios miembros de un grupo determinado global $ari; $ari->popup = 1; // no mostrar el main_frame $i = 0; $result = array(); $return = array(); if (isset($_POST['id'])) { $grupo = new seguridad_group($_POST['id']); if ($usuarios = seguridad_group::listUsersFor($grupo)) { foreach ($usuarios as $u) { $return[$i]['id'] = $u->get('user'); $return[$i]['uname'] = $u->name(); $i++; } } $result["totalCount"] = $i; $result["topics"] = $return; } else { throw new OOB_Exception_400("La variable [id] no esta definida"); } //RESULTADO $obj_comunication = new OOB_ext_comunication(); $obj_comunication->set_data($result); $obj_comunication->send(true, true);
$tmpUser = new oob_user($real_members[$i]); $grupo->removeUser($tmpUser); } } for ($i = 0; $i < count($miebros); $i++) { if (!in_array($miebros[$i], $real_members)) { $tmpUser = new oob_user($miebros[$i]); $grupo->addUser($tmpUser); } } } //FIN ACTUALIZACION $return = array(); $i = 0; if ($value != "") { if ($usuarios = seguridad_group::searchNoMembers($value, DELETED, OPERATOR_DISTINCT, $grupo->get("group"))) { foreach ($usuarios as $u) { $return[$i]['id'] = $u->get('user'); $return[$i]['uname'] = $u->name(); $i++; } //end each } //end if } //end if $result["totalCount"] = $i; $result["topics"] = $return; } else { throw new OOB_Exception_400("La variable [id] no esta definida"); }
<?php #OOB/N1 Framework [2008 - Nutus] - PM // Codigo por JPC // Script que procesa los datos del FORM UPDATE GROUP global $ari; $ari->popup = 1; $resultado = array(); $resultado["errors"] = array(); $resultado["success"] = false; //id if (isset($_POST['id'])) { if (OOB_validatetext::isNumeric($_POST['id'])) { $grupo = new seguridad_group($_POST['id']); } else { throw new OOB_Exception_400("La variable [id] es invalida"); } } else { throw new OOB_Exception_400("La variable [id] no esta definida"); } //nombre if (isset($_POST['txt_nombre'])) { $grupo->set('name', $_POST['txt_nombre']); } else { throw new OOB_Exception_400("La variable [txt_nombre] no esta definida"); } //descripcion if (isset($_POST['txt_descripcion'])) { $grupo->set('description', $_POST['txt_descripcion']); } else { throw new OOB_Exception_400("La variable [txt_descripcion] no esta definida");
<?php #OOB/N1 Framework [2008 - Nutus] - PM // Código por JPCOSEANI // Script que PROCESA LOS DATOS DEL FORM NUEVO GRUPO global $ari; $ari->popup = 1; $resultado = array(); $resultado["errors"] = array(); $resultado["success"] = false; $group = new seguridad_group(); //DESCRIPCION if (isset($_POST['txt_descripcion'])) { $group->set('description', $_POST['txt_descripcion']); } else { throw new OOB_Exception_400("La variable [txt_descripcion] no esta definida"); } //NOMBRE if (isset($_POST['txt_nombre'])) { $group->set('name', $_POST['txt_nombre']); } else { throw new OOB_Exception_400("La variable [txt_nombre] no esta definida"); } //ESTADO $group->set('status', 1); //TRATAMOS DE GRABAR if ($group->store()) { $resultado["success"] = true; $resultado["id"] = $group->id(); } if ($errores = $ari->error->getErrorsfor("seguridad_group")) {