本文整理汇总了PHP中users::getAttr方法的典型用法代码示例。如果您正苦于以下问题:PHP users::getAttr方法的具体用法?PHP users::getAttr怎么用?PHP users::getAttr使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类users
的用法示例。
在下文中一共展示了users::getAttr方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: dropdownUserType
public static function dropdownUserType($data, $selected = NULL, $extra = '')
{
// standardize the $data as an array, strings default to the class_type
if (!is_array($data)) {
$data = array('name' => $data);
}
// add in all the defaults if they are not provided
$data += array('nullOption' => FALSE);
// append or insert the class
$data = arr::update($data, 'class', 'user_type_dropdown');
// render a null option if its been set in data
if (!empty($data['nullOption'])) {
$options = array(0 => $data['nullOption']);
} else {
$options = array();
}
unset($data['nullOption']);
$userTypes = self::getUserTypes();
foreach ($userTypes as $userType => $displayName) {
if ($userType <= users::getAttr('user_type')) {
$options[$userType] = $displayName;
}
}
// use kohana helper to generate the markup
return form::dropdown($data, $options, $selected, $extra);
}
示例2: echo_test
public static function echo_test()
{
$featureCode = new FeatureCode();
$featureCode['name'] = 'Echo Test';
$featureCode['registry'] = array('feature' => 'echo');
$featureCode->save();
try {
$location = Doctrine::getTable('Location')->findAll();
if (!$location->count()) {
throw Exception('Could not find location id');
}
$location_id = arr::get($location, 0, 'location_id');
$number = new Number();
$number['user_id'] = users::getAttr('user_id');
$number['number'] = '9999';
$number['location_id'] = $location_id;
$number['registry'] = array('ignoreFWD' => '0', 'ringtype' => 'ringing', 'timeout' => 20);
$dialplan = array('terminate' => array('transfer' => 0, 'voicemail' => 0, 'action' => 'hangup'));
$number['dialplan'] = $dialplan;
$number['class_type'] = 'FeatureCodeNumber';
$number['foreign_id'] = $featureCode['feature_code_id'];
$context = Doctrine::getTable('Context')->findOneByName('Outbound Routes');
$number['NumberContext']->fromArray(array(0 => array('context_id' => $context['context_id'])));
$numberType = Doctrine::getTable('NumberType')->findOneByClass('FeatureCodeNumber');
if (empty($numberType['number_type_id'])) {
return FALSE;
}
$number['NumberPool']->fromArray(array(0 => array('number_type_id' => $numberType['number_type_id'])));
$number->save();
return $number['number_id'];
} catch (Exception $e) {
kohana::log('error', 'Unable to initialize device number: ' . $e->getMessage());
throw $e;
}
}
示例3: __construct
public function __construct()
{
parent::__construct();
if (users::getAttr('user_type') != User::TYPE_SYSTEM_ADMIN) {
message::set('You are not authorized to manage sip interfaces!');
$this->returnQtipAjaxForm(NULL);
url::redirect('/');
}
}
示例4: login
public function login($userId)
{
if (users::getAttr('user_type') == User::TYPE_SYSTEM_ADMIN) {
users::masqueradeUser($userId);
url::redirect('/');
} else {
Event::run('system.404');
die;
}
}
示例5: index
public function index()
{
stylesheet::add('callcenter');
javascript::add('callcenter');
javascript::add('jquery-ui-1-7-2-custom');
// Prepare device info for use
$device_info = array();
$location_id = users::getAttr('location_id');
$location = Doctrine::getTable('Location')->findOneBy('location_id', $location_id);
foreach ($location['User'] as $user) {
foreach ($user['Device'] as $device) {
$device_info[] = array('name' => $device['name'], 'id' => $device['device_id']);
}
}
$this->view->devices = $device_info;
$this->view->domain = $location['domain'];
}
示例6: maintenance
public static function maintenance()
{
kohana::log('debug', 'Preforming maintenance on the media files');
$accountId = users::getAttr('account_id');
if (!empty($accountId)) {
$records = Doctrine::getTable('MediaFile')->findAll();
foreach ($records as $record) {
kohana::log('debug', 'the path is ' . $record->filepath(TRUE) . ' and does it exists? ' . is_file($record->filepath(TRUE)));
//if (!file_exists($record->filepath(TRUE)))
if (!is_file($record->filepath(TRUE))) {
//kohana::log('debug', 'mediafile_id to be deleted :'.$record->filepath(TRUE));
kohana::log('debug', 'The mediafile_id ' . $record['mediafile_id'] . ' no longer exists...');
$record->delete();
}
}
} else {
kohana::log('debug', 'Account_ID Empty or Invalid, canceling the maintenance on the media files');
}
}
示例7: createSubGrid
public function createSubGrid()
{
$subview = new View('generic/grid');
$subview->tab = 'main';
$subview->section = 'general';
// Setup the base grid object
$grid = jgrid::grid('User', array('caption' => 'Users'));
// If there is a base model that contains an account_id,
// then we want to show locations only that relate to this account
$base = $this->getBaseModelObject();
if ($base and !empty($base['location_id'])) {
// Set a where clause, if we're playing plug-in to someone else
$grid->where('location_id = ', $base['location_id']);
} else {
if ($base and !empty($base['account_id'])) {
// Set a where clause, if we're playing plug-in to someone else
$grid->where('account_id = ', $base['account_id']);
}
}
// Add the base model columns to the grid
$grid->add('user_id', 'ID', array('hidden' => TRUE, 'key' => TRUE));
$grid->add('email_address', 'Email Address');
$grid->add('first_name', 'First Name', array('width' => '100', 'search' => TRUE));
$grid->add('last_name', 'Last Name', array('width' => '100', 'search' => TRUE));
$grid->add('Location/name', 'Location', array('hidden' => empty($base['location_id']) ? TRUE : FALSE, 'width' => '100', 'search' => TRUE, 'sortable' => TRUE));
$grid->add('user_type', 'User Type', array('callback' => array('function' => array($this, 'userType'), 'arguments' => array('user_type'))));
$grid->add('logins', 'Logins', array('hidden' => TRUE));
$grid->add('last_login', 'Last Login', array('hidden' => TRUE));
$grid->add('last_logged_ip', 'Last Logged IP', array('hidden' => TRUE));
$grid->add('debug_level', 'Debug Level', array('hidden' => TRUE));
// Add the actions to the grid
$grid->addAction('usermanager/edit', 'Edit', array('arguments' => 'user_id', 'attributes' => array('class' => 'qtipAjaxForm')));
$grid->addAction('usermanager/delete', 'Delete', array('arguments' => 'user_id', 'attributes' => array('class' => 'qtipAjaxForm')));
if (users::getAttr('user_type') == User::TYPE_SYSTEM_ADMIN) {
$grid->addAction('usermanager/login', 'Login', array('arguments' => 'user_id'));
}
// Produces the grid markup or JSON
$subview->grid = $grid->produce();
$subview->gridMenu = html::anchor('/usermanager/create', '<span>Add New User</span>', array('class' => 'qtipAjaxForm'));
// Add our view to the main application
$this->views[] = $subview;
}
示例8: allow
public function allow($controller, $method, $options = array())
{
$userID = users::getAttr('user_id');
$permission = Doctrine_Query::create()->select('p.permission')->from('Permission p')->where('p.user_id = ?', array($userID))->andWhere('p.controller = ?', array($controller))->andWhere('p.method = ?', array($method))->execute(array(), Doctrine::HYDRATE_SINGLE_SCALAR);
if (empty($permission)) {
$permission = Doctrine_Query::create()->select('p.permission')->from('Permission p')->where('p.user_id = ?', array($userID))->andWhere('p.controller = ?', array($controller))->execute(array(), Doctrine::HYDRATE_SINGLE_SCALAR);
}
switch ($permission) {
case 'location':
case 'owner':
return $permission;
break;
case 'custom':
case 'disabled':
return FALSE;
break;
default:
return TRUE;
break;
}
}
示例9: inform
public function inform($hash = NULL)
{
$error = $this->session->get($hash, '');
$report['issue'] = empty($_POST['report']['issue']) ? '' : $_POST['report']['issue'];
$report['while'] = empty($_POST['report']['while']) ? '' : $_POST['report']['while'];
$report['contact'] = empty($_POST['report']['contact']) ? users::getAttr('email_address') : $_POST['report']['contact'];
$report['error'] = empty($_POST['report']['error']) ? $error : $_POST['report']['error'];
$report['log'] = isset($_POST['report']['log']) ? $_POST['report']['log'] : TRUE;
if ($action = $this->submitted(array('submitString' => 'Send'))) {
if ($action == self::SUBMIT_CONFIRM and $this->submitReport($report)) {
message::set('Request was submitted, you will receive emails as we update your support request. Thank you.', 'success');
$this->returnQtipAjaxForm(NULL);
url::redirect(Router_Core::$controller . '/thankYou');
} else {
if ($action == self::SUBMIT_DENY) {
$this->exitQtipAjaxForm();
}
}
}
$this->view->report = $report;
}
示例10: account
public function account($account_id = NULL, $redirect = TRUE)
{
if ($account_id && users::masqueradeAccount($account_id)) {
$masquerade_account = TRUE;
}
$loadedModels = Doctrine::getLoadedModels();
$driver = Telephony::getDriver();
$driverName = get_class($driver);
if (!$driver) {
message::set('Can not rebuild configuration, no telephony driver active');
} else {
try {
foreach ($loadedModels as $model) {
$modelDriverName = $driverName . '_' . $model . '_Driver';
if (!class_exists($modelDriverName, TRUE)) {
continue;
}
$outputRows = Doctrine::getTable($model)->findAll();
foreach ($outputRows as $outputRow) {
Telephony::set($outputRow, $outputRow->identifier());
}
}
Telephony::save();
Telephony::commit();
$account = Doctrine::getTable('Account')->find(users::getAttr('account_id'));
parent::save_succeeded($account);
message::set(users::getAttr('Account', 'name') . ' configuration rebuild complete!', 'success');
} catch (Exception $e) {
message::set($e->getMessage());
}
}
if (!empty($masquerade_account)) {
users::restoreAccount();
}
$this->returnQtipAjaxForm();
if ($redirect) {
url::redirect(Router_Core::$controller);
}
}
示例11: filepath
public function filepath($full = FALSE, $actual = TRUE)
{
$basepath = kohana::config('upload.directory');
$basepath = rtrim($basepath, DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR . users::getAttr('account_id');
Event::run('mediafile.basepath', $basepath);
$filepath = rtrim($basepath, DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR;
if ($this->get('path')) {
$filepath .= rtrim($this->get('path'), DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR;
}
if (!$actual and kohana::config('mediafile.hide_rate_folders')) {
$default_rates = kohana::config('mediafile.default_rates');
$default_rates[] = trim(kohana::config('mediafile.unknown_rate_folder'), DIRECTORY_SEPARATOR);
foreach ($default_rates as &$value) {
$value = DIRECTORY_SEPARATOR . $value . DIRECTORY_SEPARATOR;
}
$filepath = str_replace($default_rates, DIRECTORY_SEPARATOR, $filepath);
}
if ($full) {
$filepath .= $this->get('file');
}
return $filepath;
}
示例12: isset
echo form::input('user[confirm_password]', isset($confirm_password) ? $confirm_password : NULL);
?>
</div>
<?php
echo form::close_section();
?>
<?php
if (isset($views)) {
echo subview::render($views);
}
?>
<?php
if (users::getAttr('user_type') == User::TYPE_SYSTEM_ADMIN) {
?>
<?php
jquery::addPlugin('spinner');
?>
<?php
echo form::open_section('Debug');
?>
<div class="field">
<?php
echo form::label('user[debug_level]', 'UI Level:');
echo form::input('user[debug_level]');
javascript::codeBlock('$("#user_debug_level").spinner({max: 4, min: 0});');
示例13:
</div>
</div>
</div>
<!-- END OF CONTENT -->
<div class="footer">
</div>
<!-- END OF FOOTER -->
</div>
<?php
if (class_exists('DashManager', TRUE) && users::getAttr('user_id')) {
echo DashManager::renderDialogs();
}
?>
<?php
javascript::renderCodeBlocks();
?>
</body>
</html>
<?php
if (Kohana::config('core.render_stats') === TRUE) {
?>
<!-- Kohana Version: {kohana_version} -->
<!-- Kohana Codename: {kohana_codename} -->
<!-- Execution Time: {execution_time} -->
示例14: getUserId
public function getUserId()
{
return users::getAttr('Account', 'account_id');
}
示例15: blast
/**
*
* blast
* <user>@<domain> <sound_file> [<cid_num>] [<cid_name>]
* voicemail_inject is used to add an arbitrary sound file to a users voicemail mailbox.
*/
public function blast()
{
$account_id = users::getAttr('account_id');
$domain = VoicemailManager::getDomain($account_id);
$this->view->mailboxes = VoicemailManager::getAllMailboxes();
if ($this->input->post()) {
if ($this->input->post('file_id') == 0) {
message::set('Select a file to to use in the voicemail message');
} else {
foreach ($this->input->post('blast') as $mailbox) {
echo VoicemailManager::blast($mailbox, $domain, Media::getMediaFile($this->input->post('file_id')));
}
}
}
}