| Current Path : /var/www/iplanru/data/www/i-plan.ru/administrator/components/com_poll/controllers/ |
| Current File : /var/www/iplanru/data/www/i-plan.ru/administrator/components/com_poll/controllers/question.php |
<?php
// No direct access
defined( '_JEXEC' ) or die;
/**
* Controller for edit current element
* @author kirdinyuri
*/
class PollControllerQuestion extends JControllerForm
{
/**
* Class constructor
* @param array $config
*/
function __construct( $config = array() )
{
$this->view_list = 'questions';
parent::__construct( $config );
}
/**
* Method override to check if you can edit an existing record.
*
* @param array $data An array of input data.
* @param string $key The name of the key for the primary key.
*
* @return boolean
* @since 1.6
*/
protected function allowEdit( $data = array(), $key = 'id' )
{
// инициализируем переменные
$recordId = ( int )isset( $data[$key] ) ? $data[$key] : 0;
//получение объекта текущего пользователя
$user = JFactory::getUser();
//Получаем идентификатор пользователя
$userId = $user->get( 'id' );
// Сначала проверяем общий доступ на редактирование и если
//пользователь может редактировать то возвращаем истину
if ( $user->authorise( 'core.edit', 'com_poll.question.' . $recordId ) ) {
return true;
}
return parent::allowEdit( $data, $key );
}
}