本文整理汇总了PHP中permissions类的典型用法代码示例。如果您正苦于以下问题:PHP permissions类的具体用法?PHP permissions怎么用?PHP permissions使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了permissions类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: listAll
public function listAll()
{
$toReturn = array();
$toReturn['grades'] = gradeLevels::get()->toArray();
$toReturn['userRole'] = $this->data['users']->role;
$toReturn['newuserRole'] = $this->data['users']->newrole;
$toReturn['userRole'] = $this->data['users']->role;
$newrole = $this->data['users']->newrole;
$newrole_array = json_decode($newrole);
$params = permissions::where('moduleId', 3)->where('permission', 1)->get();
foreach ($params as $param) {
$uniparam[] = $param->roleId;
}
if ($toReturn['userRole'] == "teacher") {
if (array_intersect($newrole_array, $uniparam)) {
$toReturn['access'] = 1;
} else {
$toReturn['access'] = 0;
}
} elseif ($toReturn['userRole'] == "admin") {
$toReturn['access'] = 1;
} else {
$toReturn['access'] = 0;
}
return $toReturn;
}
示例2: listAll
public function listAll()
{
$toReturn['exams'] = examsList::where('examAcYear', $this->panelInit->selectAcYear)->get()->toArray();
if ($this->data['users']->role == "teacher") {
$toReturn['classes'] = classes::where('classAcademicYear', $this->panelInit->selectAcYear)->where('classTeacher', 'LIKE', '%"' . $this->data['users']->id . '"%')->get()->toArray();
} else {
$toReturn['classes'] = classes::where('classAcademicYear', $this->panelInit->selectAcYear)->get()->toArray();
}
$toReturn['userRole'] = $this->data['users']->role;
$newrole = $this->data['users']->newrole;
$newrole_array = json_decode($newrole);
$params = permissions::where('moduleId', 1)->where('permission', 1)->get();
$uniparam = array(5, 6, 7, 8, 15);
if ($toReturn['userRole'] == "teacher") {
if (array_intersect($newrole_array, $uniparam)) {
$toReturn['access'] = 1;
} else {
$toReturn['access'] = 0;
}
} elseif ($toReturn['userRole'] == "admin") {
$toReturn['access'] = 1;
} else {
$toReturn['access'] = 0;
}
$toReturn['newuserRole'] = $this->data['users']->newrole;
return $toReturn;
}
示例3: smarty_function_get_nodes_by_parent
function smarty_function_get_nodes_by_parent($params, &$smarty)
{
global $node;
$sql_time = "";
$sql_type = "";
$parent = $params['parent'];
$permissions = permissions::checkPerms($parent);
if (!$permissions['r']) {
$error = $error_messages['READ_PERMISSION_ERROR'];
return false;
}
$parent_vectot = $parent['node_vector'];
if ($params['listing_amount'] == 'all') {
$listing_amount = DEF_MAX_LISTING_AMMOUNT;
} else {
$listing_amount = $params['listing_amount'];
}
if (empty($params['offset'])) {
$offset = 0;
} else {
$offset = $params['offset'];
}
if (isset($params['orderby'])) {
$orderby = db_escape_string($params['orderby']);
}
global $db, $node;
$node_id = $node['node_id'];
$user_id = $_SESSION['user_id'];
if (isset($params['time'])) {
$sql_time = " nodes.node_created > '" . db_escape_string($params['time']) . "' and ";
}
$q = "select parent.node_name as parent_name,users.*,nodes.*,node_access.node_user_subchild_count from nodes left join nodes as parent on parent.node_id=nodes.node_parent left join node_access on node_access.node_id=nodes.node_id and node_access.user_id='{$user_id}' left join users on users.user_id=nodes.node_creator where ";
$q .= " {$sql_time} nodes.node_parent='{$parent}' and nodes.node_system_access!='private'";
if (isset($_POST['template_event']) && $_POST['template_event'] == 'filter_by') {
if (isset($_POST['search_type']) && $_POST['search_type'] == 'content') {
$sql_type .= " and node_content like '%" . db_escape_string($_POST['node_content']) . "%' ";
} else {
$q2 = "select user_id from users where login='" . db_escape_string($_POST['node_content']) . "'";
$userset = $db->query($q2);
$userset->next();
$id = $userset->getString('user_id');
$sql_type = " and nodes.node_creator='{$id}'";
}
$q .= $sql_type;
}
if (isset($orderby)) {
$q .= " order by {$orderby} ";
} else {
$q .= " order by nodes.node_id desc ";
}
$q .= " LIMIT {$offset},{$listing_amount} ";
$set = $db->query($q);
while ($set->next()) {
$pole[] = $set->getRecord();
}
$smarty->assign('get_nodes_by_parent', $pole);
}
示例4: update
public function update()
{
$moduleId = Input::get('moduleId');
$roleId = Input::get('roleId');
$permissionValue = Input::get('permission');
$matchThese = ['moduleId' => $moduleId, 'roleId' => $roleId];
$permissions = permissions::where('roleId', '=', $roleId)->first();
$query = 'update permissions set permission= ' . $permissionValue . ' where moduleId =' . $moduleId . ' and roleId=' . $roleId;
$result = DB::update($query);
return 1;
}
示例5: getUserWarns
/**
* Возвращает список предупреждение пользователя для попап окна.
*
* @param int $uid UID пользователя
* @param array $contextId Контекст (для лога админских действий)
* @param string $draw_func способ отображения
*
* @return object xajaxResponse
*/
function getUserWarns($uid = 0, $contextId = '', $draw_func = '')
{
session_start();
$objResponse = new xajaxResponse();
if (hasPermissions('users')) {
require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/permissions.php';
require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/users.php';
$user = new users();
$user->GetUserByUID($uid);
if ($user->uid) {
$aPermissions = permissions::getUserPermissions($_SESSION['uid']);
$admin_log = new admin_log('user', $_SESSION['uid'], $aPermissions);
$aWarns = $admin_log->getUserWarns($nCount, $uid);
$sCount = $nCount ? $nCount : '0';
$sWarns = $user->warn ? $user->warn : '0';
$objResponse->assign('a_user_warns', 'href', '/users/' . $user->login);
$objResponse->assign('s_user_warns', 'innerHTML', $user->uname . ' ' . $user->usurname . ' [' . $user->login . ']');
$objResponse->assign('e_user_warns', 'innerHTML', $sWarns);
$objResponse->assign('n_user_warns', 'innerHTML', $sCount);
if ($nCount) {
$sTable = '<table id="t_user_warns" class="notice-table">';
$nCount = 1;
foreach ($aWarns as $aOne) {
$sReason = $aOne['admin_comment'] ? hyphen_words($aOne['admin_comment'], true) : '<без причины>';
$sAdmin = $aOne['adm_login'] ? '<a target="_blank" href="/users/' . $aOne['adm_login'] . '">' . $aOne['adm_login'] . '</a>' : 'не известно';
$sDate = $aOne['act_time'] ? date('d.m.Y H:i', strtotime($aOne['act_time'])) : 'не известно';
$sTable .= '<tr>
<td class="cell-number">' . $nCount . '.</td>
<td class="cell-uwarn">' . $sReason . '</td>
<td class="cell-who">Выдан: [' . $sAdmin . ']
<td class="cell-date">' . $sDate . '</td>
<td' . ($aOne['src_id'] ? ' id="i_user_warns_' . $aOne['src_id'] . '"' : '') . '>' . ($aOne['src_id'] ? '<a href="javascript:void(0);" onclick="banned.warnUser(' . $uid . ',' . $aOne['src_id'] . ',\'' . $draw_func . '\',\'' . $contextId . '\',0);"><img src="/images/btn-remove2.png" alt="" width="11" height="11" /></a>' : '') . '</td>
</tr>';
++$nCount;
}
$sTable .= '</table>';
$objResponse->assign('d_user_warns', 'innerHTML', $sTable);
} else {
$objResponse->assign('d_user_warns', 'innerHTML', ' ');
}
$sBanTitle = $user->is_banned || $user->ban_where ? 'Разбанить' : 'Забанить';
$objResponse->script('adminLogOverlayClose();');
$objResponse->script("\$('ov-notice4').setStyle('display', '');");
$objResponse->script('adjustUserWarnsHTML();');
$objResponse->assign('b_user_warns', 'innerHTML', '<button onclick="adminLogOverlayClose();banned.userBan(' . $uid . ', \'' . $contextId . '\',0)">' . $sBanTitle . '</button><a class="lnk-dot-grey" href="javascript:void(0);" onclick="adminLogOverlayClose();">Отмена</a>');
}
}
return $objResponse;
}
示例6: __construct
public function __construct()
{
$this->panelInit = new \DashboardInit();
$this->data['panelInit'] = $this->panelInit;
$this->data['breadcrumb']['User Settings'] = \URL::to('/dashboard/user');
$this->data['users'] = \Auth::user();
$params = permissions::where('moduleId', 2)->where('permission', 1)->get();
foreach ($params as $param) {
$uniparam[] = $param->roleId;
}
$params = permissions::where('moduleId', 4)->where('permission', 1)->get();
foreach ($params as $param) {
$uniparam2[] = $param->roleId;
}
$this->data['attendancepermission'] = $uniparam;
$this->data['staffattendancepermission'] = $uniparam2;
}
示例7: checkUserDat
function checkUserDat()
{
global $returnedDBdata;
if (!empty($_GET['Char']) && !empty($_GET['Server'])) {
// First run check for currently searched character
$charTOfetch = $_GET['Char'];
$fromWHATserver = $_GET['Server'];
// Lookup character in local DB
$resp = roster_db::lookup($charTOfetch, $fromWHATserver);
$returnedDBdata = $resp->lookupData;
// If <is || not> in local DB
if ($resp->count == 1) {
viewChar($charTOfetch, $fromWHATserver);
} else {
permissions::verify($functWanted = 'fetchCharDat', $functElse = 'recentlySyncd', $rankWanted = '0');
}
} else {
// Else if no get data to use
nochar();
}
}
示例8: get_mysql_server_version
get_mysql_server_version();
$lang = get_config('language_set');
require_once 'i18n/' . $lang . '/i18n.php';
require_once PATH_TO_CLASSES . '/cls_fast_template.php';
require_once PATH_TO_CLASSES . '/cls_permissions.php';
// inicjowanie klasy, wkazanie katalogu przechowuj±cego szablony
$ft = new FastTemplate('./templates/' . $lang . '/tpl');
// egzemplarz klasy obs³uguj±cej bazê danych Core
$db = new DB_SQL();
// pobieramy poziom uprawnieñ
$query = sprintf("\r\n SELECT \r\n permission_level \r\n FROM \r\n %1\$s \r\n WHERE \r\n login = '%2\$s'", TABLE_USERS, $_SESSION['login']);
$db->query($query);
$db->next_record();
$privileges = $db->f('permission_level');
// egzemplarz klasy do obs³ugi uprawnieñ
$perms = new permissions();
$permarr = $perms->getPermissions($privileges);
$ft->assign(array('PERMS_USER' => false, 'PERMS_WRITER' => false, 'PERMS_MODERATOR' => false, 'PERMS_TPLEDITOR' => false, 'PERMS_ADMIN' => false));
switch ($privileges) {
case '1':
$privilege_level = 1;
$ft->assign('PERMS_USER', true);
break;
case '3':
$privilege_level = 2;
$ft->assign('PERMS_USER', true);
$ft->assign('PERMS_WRITER', true);
break;
case '7':
$privilege_level = 3;
$ft->assign('PERMS_USER', true);
示例9: dialplan
//.........这里部分代码省略.........
$dialplan["dialplan_details"][$y]["dialplan_detail_tag"] = "condition";
$dialplan["dialplan_details"][$y]["dialplan_detail_type"] = "\${caller_id_name}";
$dialplan["dialplan_details"][$y]["dialplan_detail_data"] = "^([^#]+#)(.*)\$";
$dialplan["dialplan_details"][$y]["dialplan_detail_break"] = "never";
$dialplan["dialplan_details"][$y]["dialplan_detail_group"] = "1";
$dialplan["dialplan_details"][$y]["dialplan_detail_order"] = $y * 10;
$y++;
$dialplan["dialplan_details"][$y]["domain_uuid"] = $this->domain_uuid;
$dialplan["dialplan_details"][$y]["dialplan_detail_tag"] = "action";
$dialplan["dialplan_details"][$y]["dialplan_detail_type"] = "set";
$dialplan["dialplan_details"][$y]["dialplan_detail_data"] = "caller_id_name=\$2";
$dialplan["dialplan_details"][$y]["dialplan_detail_group"] = "1";
$dialplan["dialplan_details"][$y]["dialplan_detail_order"] = $y * 10;
$y++;
$dialplan["dialplan_details"][$y]["domain_uuid"] = $this->domain_uuid;
$dialplan["dialplan_details"][$y]["dialplan_detail_tag"] = "condition";
$dialplan["dialplan_details"][$y]["dialplan_detail_type"] = "destination_number";
$dialplan["dialplan_details"][$y]["dialplan_detail_data"] = "^" . $this->destination_number . "\$";
$dialplan["dialplan_details"][$y]["dialplan_detail_break"] = "";
$dialplan["dialplan_details"][$y]["dialplan_detail_group"] = "2";
$dialplan["dialplan_details"][$y]["dialplan_detail_order"] = $y * 10;
$y++;
$dialplan["dialplan_details"][$y]["domain_uuid"] = $this->domain_uuid;
$dialplan["dialplan_details"][$y]["dialplan_detail_tag"] = "action";
$dialplan["dialplan_details"][$y]["dialplan_detail_type"] = "answer";
$dialplan["dialplan_details"][$y]["dialplan_detail_data"] = "";
$dialplan["dialplan_details"][$y]["dialplan_detail_group"] = "2";
$dialplan["dialplan_details"][$y]["dialplan_detail_order"] = $y * 10;
$y++;
$dialplan["dialplan_details"][$y]["domain_uuid"] = $this->domain_uuid;
$dialplan["dialplan_details"][$y]["dialplan_detail_tag"] = "action";
$dialplan["dialplan_details"][$y]["dialplan_detail_type"] = "set";
$dialplan["dialplan_details"][$y]["dialplan_detail_data"] = "hangup_after_bridge=true";
$dialplan["dialplan_details"][$y]["dialplan_detail_group"] = "2";
$dialplan["dialplan_details"][$y]["dialplan_detail_order"] = $y * 10;
$y++;
if (strlen($this->queue_cid_prefix) > 0) {
$dialplan["dialplan_details"][$y]["domain_uuid"] = $this->domain_uuid;
$dialplan["dialplan_details"][$y]["dialplan_detail_tag"] = "action";
$dialplan["dialplan_details"][$y]["dialplan_detail_type"] = "set";
$dialplan["dialplan_details"][$y]["dialplan_detail_data"] = "effective_caller_id_name=" . $this->queue_cid_prefix . "#\${caller_id_name}";
$dialplan["dialplan_details"][$y]["dialplan_detail_group"] = "2";
$dialplan["dialplan_details"][$y]["dialplan_detail_order"] = $y * 10;
$y++;
}
$dialplan["dialplan_details"][$y]["domain_uuid"] = $this->domain_uuid;
$dialplan["dialplan_details"][$y]["dialplan_detail_tag"] = "action";
$dialplan["dialplan_details"][$y]["dialplan_detail_type"] = "callcenter";
$dialplan["dialplan_details"][$y]["dialplan_detail_data"] = $this->queue_name . '@' . $_SESSION["domain_name"];
$dialplan["dialplan_details"][$y]["dialplan_detail_group"] = "2";
$dialplan["dialplan_details"][$y]["dialplan_detail_order"] = $y * 10;
$y++;
if (strlen($this->queue_timeout_action) > 0) {
$action_array = explode(":", $this->queue_timeout_action);
$dialplan["dialplan_details"][$y]["domain_uuid"] = $this->domain_uuid;
$dialplan["dialplan_details"][$y]["dialplan_detail_tag"] = "action";
$dialplan["dialplan_details"][$y]["dialplan_detail_type"] = $action_array[0];
$dialplan["dialplan_details"][$y]["dialplan_detail_data"] = substr($this->queue_timeout_action, strlen($action_array[0]) + 1, strlen($this->queue_timeout_action));
$dialplan["dialplan_details"][$y]["dialplan_detail_group"] = "2";
$dialplan["dialplan_details"][$y]["dialplan_detail_order"] = $y * 10;
$y++;
}
$dialplan["dialplan_details"][$y]["domain_uuid"] = $this->domain_uuid;
$dialplan["dialplan_details"][$y]["dialplan_detail_tag"] = "action";
$dialplan["dialplan_details"][$y]["dialplan_detail_type"] = "hangup";
$dialplan["dialplan_details"][$y]["dialplan_detail_data"] = "";
$dialplan["dialplan_details"][$y]["dialplan_detail_group"] = "2";
$dialplan["dialplan_details"][$y]["dialplan_detail_order"] = $y * 10;
//add the dialplan permission
$p = new permissions();
$p->add("dialplan_add", 'temp');
$p->add("dialplan_detail_add", 'temp');
$p->add("dialplan_edit", 'temp');
$p->add("dialplan_detail_edit", 'temp');
//save the dialplan
$orm = new orm();
$orm->name('dialplans');
$orm->save($dialplan);
$dialplan_response = $orm->message;
$this->dialplan_uuid = $dialplan_response['uuid'];
//if new dialplan uuid then update the call center queue
$sql = "update v_call_center_queues ";
$sql .= "set dialplan_uuid = '" . $this->dialplan_uuid . "' ";
$sql .= "where call_center_queue_uuid = '" . $this->call_center_queue_uuid . "' ";
$sql .= "and domain_uuid = '" . $this->domain_uuid . "' ";
$this->db->exec($sql);
unset($sql);
//remove the temporary permission
$p->delete("dialplan_add", 'temp');
$p->delete("dialplan_detail_add", 'temp');
$p->delete("dialplan_edit", 'temp');
$p->delete("dialplan_detail_edit", 'temp');
//synchronize the xml config
save_dialplan_xml();
//clear the cache
$cache = new cache();
$cache->delete("dialplan:" . $_SESSION['context']);
//return the dialplan_uuid
return $dialplan_response;
}
示例10: foreach
">
<input type="submit" value=" Показать ">
</form>
<br><br>
<table width="100%" border="0" cellspacing="5" cellpadding="5">
<?php
if ($users) {
?>
<?php
foreach ($users as $user) {
?>
<?php
$user_groups = permissions::getUserGroups($user['uid']);
$user_rights = permissions::getUserExtraRights($user['uid']);
$utype = is_emp($user['role']) ? 'emp' : 'frl';
?>
<tr>
<td>
<table width="100%" cellspacing="0" cellpadding="0" border="0">
<tr valign="top" class="n_qpr">
<td width="70" align="center"><a name="user_<?php
echo $user['uid'];
?>
"></a><a href="/users/<?php
echo $user['login'];
?>
" class="<?php
echo $utype;
?>
示例11: AddForum
/**
* Adds a forum with parameters from $this->post
*
* @author Mark Elliot <mark.elliot@mercuryboard.com>
* @since Beta 2.1
* @return string Completion message
**/
function AddForum()
{
if (trim($this->post['name']) == '') {
return "The forum name is empty. (Please press back and enter a name)";
}
$forums = $this->forum_grab();
$forums_arr = $this->forum_array($forums, $this->post['parent']);
$position = $forums_arr ? count($forums_arr) : 0;
$this->db->query("INSERT INTO {$this->pre}forums\r\n\t\t(forum_tree, forum_parent, forum_name, forum_description, forum_position) VALUES\r\n\t\t('" . $this->CreateTree($forums, $this->post['parent']) . "', '{$this->post['parent']}', '{$this->post['name']}', '{$this->post['description']}', '{$position}')");
$id = $this->db->insert_id();
$perms = new permissions();
$perms->db =& $this->db;
$perms->pre =& $this->pre;
while ($perms->get_group()) {
// Full permissions (note: the banned group is still false)
if ($this->post['sync'] == -2) {
$perms->add_z($id, $perms->group != USER_BANNED);
// Default permissions (only works if there are no forums already created)
} elseif ($this->post['sync'] == -3) {
$perms->add_z($id);
// No permissions
} elseif ($this->post['sync'] == -1) {
$perms->add_z($id, false);
// Copy another forum
} else {
$perms->add_z($id, false);
foreach ($perms->standard as $perm => $false) {
if (!isset($perms->globals[$perm])) {
$perms->set_xyz($perm, $id, $perms->auth($perm, $this->post['sync']));
}
}
}
$perms->update();
}
return "Forum added!<br/><br/><a href='{$this->self}'>Continue</a>";
}
示例12: permissions
$p_level = 1;
break;
case '3':
$p_level = 2;
break;
case '7':
$p_level = 3;
break;
case '15':
$p_level = 4;
break;
case '31':
$p_level = 5;
break;
}
$new_permissions = new permissions();
if ($plevel == "down") {
if ($p_level == 1) {
$ft->assign('CONFIRM', $i18n['edit_users'][8]);
} else {
$p_level = $p_level - 1;
switch ($p_level) {
case '3':
$new_permissions->permissions["user"] = TRUE;
$new_permissions->permissions["writer"] = TRUE;
$new_permissions->permissions["moderator"] = TRUE;
break;
case '2':
$new_permissions->permissions["user"] = TRUE;
$new_permissions->permissions["writer"] = TRUE;
break;
示例13: listar
function listar($tpl)
{
if (isset($_POST['submit_corps_search'])) {
//Se toma el n�mero de registros y se guarda en varable de sesi�n
//que se cumpla en todos los accesos del usuario
$_SESSION['num_regs'] = $_POST['regs'];
}
$num = $this->get_list_emps($_SESSION['ident_corp']);
$tabla_listado = new table(true);
$per = new permissions();
$per->get_permissions_list('emps');
if ($num == 0) {
$cadena = '' . $cadena . $tabla_listado->tabla_vacia('emps', $per->add);
$variables = $tabla_listado->nombres_variables;
} else {
$cadena = '' . $tabla_listado->make_tables('emps', $this->emps_list, array('Nombre', 20, 'Primer Apellido', 20, 'Segundo Apellido', 20), array($this->ddbb_id_emp, $this->ddbb_name, $this->ddbb_last_name, $this->ddbb_last_name2), $_SESSION['num_regs'], $per->permissions_module, $per->add);
$variables = $tabla_listado->nombres_variables;
}
$tpl->assign('variables', $variables);
$tpl->assign('cadena', $cadena);
return $tpl;
}
示例14: updateUser
/**
* Изменить информацию о группах и правах пользователя
*
* @param integer $uid ID пользователя
* @param array $groups Информация о группах
* @param array $rights_allow Информация о разрешенных правах
*/
function updateUser($uid, $groups, $rights_allow)
{
global $DB;
$user_groups_rights = array();
if (!is_array($rights_allow)) {
$rights_allow = array();
}
if (!is_array($rights_disallow)) {
$rights_disallow = array();
}
$sql = "DELETE FROM permissions_groups_users WHERE user_id=?i";
$DB->query($sql, $uid);
$sql = "DELETE FROM permissions_rights_users WHERE user_id=?i";
$DB->query($sql, $uid);
if (is_array($groups)) {
$sql = "";
if ($groups) {
foreach ($groups as $group) {
$g_rights = permissions::getGroupInfo($group);
if ($g_rights['rights']) {
foreach ($g_rights['rights'] as $g_right) {
if (!in_array($g_right, $user_groups_rights)) {
array_push($user_groups_rights, $g_right);
}
}
}
$sql .= "INSERT INTO permissions_groups_users(group_id,user_id) VALUES({$group},{$uid});\n ";
}
$DB->query($sql);
$DB->query("UPDATE users SET is_chuck = true WHERE uid = {$uid}");
}
}
$tr_allow = array_diff($rights_allow, $user_groups_rights);
$tr_disallow = array_diff($user_groups_rights, $rights_allow);
$rights_allow = $tr_allow;
$rights_disallow = $tr_disallow;
if (is_array($rights_allow)) {
$sql = "";
if ($rights_allow) {
foreach ($rights_allow as $right) {
$sql .= "INSERT INTO permissions_rights_users(right_id,user_id,is_allow) VALUES({$right},{$uid},'t');\n ";
}
$DB->query($sql);
}
}
if (is_array($rights_disallow)) {
$sql = "";
if ($rights_disallow) {
foreach ($rights_disallow as $right) {
$sql .= "INSERT INTO permissions_rights_users(right_id,user_id,is_allow) VALUES({$right},{$uid},'f');\n ";
}
$DB->query($sql);
}
}
}
示例15: view
function view($id, $tpl)
{
/*
Cosas que faltan por hacer:
De forma general, mirar los permisos del usuario que vaya a acceder aqui, para saber si tiene permisos de borrar editar ver etc...
Averiguar como pasar el numero de registros, si va a ser a grupos a grupos, si va a ser a modulos, a modulos
Order By (y mantener la b�squeda en el caso de que hubiera hecha una y averiguar la "pesta�a" a la que hace referencia)
Busquedas
*/
$cadena = '';
// Leemos la empresa y se lo pasamos a la plantilla
$this->read($id);
$tpl->assign('objeto', $this);
$_SESSION['id_client'] = $this->id_client;
//listado de contactos
$tabla_contactos = new table(false);
$contactos = new contacts();
if ($contactos->get_list_contacts($_SESSION['id_client']) == 0) {
$per = new permissions();
$per->get_permissions_list('clients');
$cadena = $cadena . $tabla_contactos->tabla_vacia('contacts', $per->add);
$variables_empleados = $tabla_contactos->nombres_variables;
} else {
$per = new permissions();
$per->get_permissions_list('clients');
$cadena = $cadena . $tabla_contactos->make_tables('contacts', $contactos->contacts_list, array('Nombre', 20, 'Primer Apellido', 20, 'Segundo Apellido', 20), array('id_contact', 'name', 'last_name', 'last_name2'), $_SESSION['num_regs'], $per->permissions_module, $per->add);
$variables_contactos = $tabla_contactos->nombres_variables;
}
$facturaspen = new table(false);
$facturascob = new table(false);
$albaranes = new table(false);
$partes = new table(false);
$cadena = $cadena . $facturaspen->dont_show('facturaspen');
$cadena = $cadena . $facturascob->dont_show('facturascob');
$cadena = $cadena . $albaranes->dont_show('albaranes');
$cadena = $cadena . $partes->dont_show('partes');
$variables_facturaspen = $facturaspen->nombres_variables;
$variables_facturascob = $facturascobs->nombres_variables;
$variables_albaranes = $albaranes->nombres_variables;
$variables_partes = $partes->nombres_variables;
$i = 0;
while ($i < count($variables_contactos) + count($variables_facturaspen) + count($variables_facturascob) + count($variables_products) + count($variables_services) + count($variables_albaranes) + count($variables_partes)) {
for ($j = 0; $j < count($variables_contactos); $j++) {
$variables[$i] = $variables_contactos[$j];
$i++;
}
for ($j = 0; $j < count($variables_facturaspen); $j++) {
$variables[$i] = $variables_facturaspen[$j];
$i++;
}
for ($j = 0; $j < count($variables_facturascob); $j++) {
$variables[$i] = $variables_facturascob[$j];
$i++;
}
for ($j = 0; $j < count($variables_albaranes); $j++) {
$variables[$i] = $variables_albaranes[$j];
$i++;
}
for ($j = 0; $j < count($variables_partes); $j++) {
$variables[$i] = $variables_partes[$j];
$i++;
}
}
//Se comprueba si hay permiso para borrar o modificar
$permisos_mod_del = new permissions();
$permisos_mod_del->get_permissions_modify_delete('clients');
$tpl->assign('acciones', $permisos_mod_del->per_mod_del);
$tpl->assign('variables', $variables);
$tpl->assign('cadena', $cadena);
//
return $tpl;
}