Revize c1bdc1c4
Přidáno uživatelem Michal Kliment před více než 9 roky(ů)
application/controllers/members.php | ||
---|---|---|
*
|
||
*/
|
||
|
||
require_once APPPATH."libraries/vtwsclib/Vtiger/WSClient.php";
|
||
|
||
/**
|
||
* Controller performs members actions such as viewing, editing profile,
|
||
* registration export, applicants approval, etc.
|
||
... | ... | |
$filter_form = Members_Controller::create_filter_form();
|
||
|
||
// gets new selector
|
||
if (is_numeric($this->input->get('record_per_page')))
|
||
$limit_results = (int) $this->input->get('record_per_page');
|
||
if (is_numeric($this->input->post('record_per_page')))
|
||
$limit_results = (int) $this->input->post('record_per_page');
|
||
|
||
// parameters control
|
||
$allowed_order_type = array
|
||
(
|
||
'id', 'registration', 'name', 'street','redirect', 'street_number',
|
||
'town', 'quarter', 'ZIP_code', 'qos_ceil', 'qos_rate', 'entrance_fee',
|
||
'town', 'quarter', 'ZIP_code', 'entrance_fee',
|
||
'debt_payment_rate', 'current_credit', 'entrance_date', 'comment',
|
||
'balance', 'type_name', 'redirect', 'whitelisted'
|
||
);
|
||
... | ... | |
|
||
// load members
|
||
$model_members = new Member_Model();
|
||
$total_members = $model_members->count_all_members($filter_form->as_sql());
|
||
|
||
// hide grid on its first load (#442)
|
||
$hide_grid = Settings::get('grid_hide_on_first_load') && $filter_form->is_first_load();
|
||
|
||
if (!$hide_grid)
|
||
{
|
||
try
|
||
{
|
||
$total_members = $model_members->count_all_members($filter_form->as_sql());
|
||
|
||
// limit check
|
||
if (($sql_offset = ($page - 1) * $limit_results) > $total_members)
|
||
$sql_offset = 0;
|
||
// limit check
|
||
if (($sql_offset = ($page - 1) * $limit_results) > $total_members)
|
||
$sql_offset = 0;
|
||
|
||
// query data
|
||
$query = $model_members->get_all_members(
|
||
$sql_offset, $limit_results, $order_by, $order_by_direction,
|
||
$filter_form->as_sql()
|
||
);
|
||
// query data
|
||
$query = $model_members->get_all_members(
|
||
$sql_offset, $limit_results, $order_by, $order_by_direction,
|
||
$filter_form->as_sql()
|
||
);
|
||
}
|
||
catch (Exception $e)
|
||
{
|
||
if ($filter_form->is_loaded_from_saved_query())
|
||
{
|
||
status::error('Invalid saved query', $e);
|
||
// disable default query (loop protection)
|
||
if ($filter_form->is_loaded_from_default_saved_query())
|
||
{
|
||
ORM::factory('filter_query')->remove_default($filter_form->get_base_url());
|
||
}
|
||
$this->redirect(url_lang::current());
|
||
}
|
||
throw $e;
|
||
}
|
||
|
||
}
|
||
|
||
// headline
|
||
$headline = __('List of all members');
|
||
// path to form
|
||
$path = Config::get('lang') . '/members/show_all/' . $limit_results . '/'
|
||
. $order_by . '/' . $order_by_direction.'/'.$page_word.'/'
|
||
... | ... | |
'selector_max_multiplier' => 25,
|
||
'base_url' => $path,
|
||
'uri_segment' => 'page',
|
||
'total_items' => $total_members,
|
||
'total_items' => isset($total_members) ? $total_members : 0,
|
||
'items_per_page' => $limit_results,
|
||
'style' => 'classic',
|
||
'order_by' => $order_by,
|
||
... | ... | |
));
|
||
}
|
||
|
||
if ($this->acl_check_edit('Members_Controller', 'registration'))
|
||
if (!$hide_grid && $this->acl_check_edit('Members_Controller', 'registration'))
|
||
{
|
||
if (!$regs)
|
||
{
|
||
... | ... | |
}
|
||
}
|
||
|
||
if ($this->acl_check_view(get_class($this), 'members'))
|
||
if (!$hide_grid && $this->acl_check_view(get_class($this), 'members'))
|
||
{
|
||
// export contacts
|
||
$grid->add_new_button(
|
||
'export/vcard/members' . server::query_string(),
|
||
'Export contacts', array
|
||
(
|
||
'title' => __('Export contacts'),
|
||
'class' => 'popup_link'
|
||
)
|
||
);
|
||
|
||
// csv export of members
|
||
$grid->add_new_button(
|
||
'export/csv/members' . server::query_string(),
|
||
... | ... | |
)
|
||
);
|
||
|
||
$grid->add_new_button(
|
||
'notifications/members/' . server::query_string(),
|
||
'Notifications'
|
||
);
|
||
if (module::e('notification') &&
|
||
$this->acl_check_new('Notifications_Controller', 'members'))
|
||
{
|
||
$grid->add_new_button(
|
||
'notifications/members/' . server::query_string(),
|
||
'Notifications'
|
||
);
|
||
}
|
||
}
|
||
// database columns - some are commented out because of lack of space
|
||
|
||
... | ... | |
->callback('callback::registration_field');
|
||
}
|
||
|
||
$grid->order_field('type');
|
||
$grid->order_callback_field('type')
|
||
->callback('callback::member_type_field');
|
||
|
||
$grid->order_field('name');
|
||
|
||
... | ... | |
|
||
$grid->order_field('town');
|
||
|
||
$grid->order_callback_field('balance')
|
||
->callback('callback::balance_field');
|
||
if (Settings::get('finance_enabled'))
|
||
{
|
||
$grid->order_callback_field('balance')
|
||
->callback('callback::balance_field');
|
||
}
|
||
|
||
$grid->order_callback_field('redirect')
|
||
->label('Redirection')
|
||
->callback('callback::redirect_field');
|
||
if (Settings::get('redirection_enabled'))
|
||
{
|
||
$grid->order_callback_field('redirect')
|
||
->label('Redirection')
|
||
->callback('callback::redirect_field');
|
||
}
|
||
|
||
$grid->order_callback_field('whitelisted')
|
||
->label('Whitelist')
|
||
->callback('callback::whitelisted_field');
|
||
if (module::e('notification'))
|
||
{
|
||
$grid->order_callback_field('whitelisted')
|
||
->label('Whitelist')
|
||
->callback('callback::whitelisted_field');
|
||
}
|
||
|
||
$actions = $grid->grouped_action_field();
|
||
|
||
... | ... | |
->url('members/show')
|
||
->label('Show member');
|
||
}
|
||
|
||
if ($this->acl_check_edit(get_class($this), 'members'))
|
||
|
||
if (Settings::get('finance_enabled') && $this->acl_check_edit(get_class($this), 'members'))
|
||
{
|
||
$actions->add_action('aid')
|
||
->icon_action('money')
|
||
->url('transfers/show_by_account')
|
||
->label('Show transfers');
|
||
}
|
||
|
||
// load data
|
||
$grid->datasource($query);
|
||
|
||
if (isset($_POST) && count ($_POST))
|
||
if (!$hide_grid)
|
||
{
|
||
// load data
|
||
$grid->datasource($query);
|
||
}
|
||
|
||
if (isset($_POST) && count($_POST) > 1)
|
||
{
|
||
$ids = $_POST["ids"];
|
||
$regs = $_POST["registrations"];
|
||
|
||
|
||
ORM::factory('member')->update_member_registrations($ids, $regs);
|
||
|
||
|
||
status::success('Registrations has been successfully updated.');
|
||
|
||
|
||
url::redirect($_POST['url']);
|
||
}
|
||
|
||
$headline = __('List of all members');
|
||
|
||
// view
|
||
$view = new View('main');
|
||
... | ... | |
* Function shows list of all registered applicants.
|
||
*
|
||
* @author Ondřej Fibich
|
||
* @param integer $limit_results
|
||
* @param string $order_by
|
||
* @param string $order_by_direction
|
||
* @param integer $page_word
|
||
* @param integer $page
|
||
*/
|
||
public function applicants()
|
||
public function applicants(
|
||
$limit_results = 40, $order_by = 'id',
|
||
$order_by_direction = 'ASC', $page_word = 'page', $page = 1,
|
||
$regs = 0)
|
||
{
|
||
// access rights
|
||
if (!$this->acl_check_view(get_class($this),'members'))
|
||
Controller::error(ACCESS);
|
||
|
||
// query
|
||
$town_model = new Town_Model();
|
||
$street_model = new Street_Model();
|
||
|
||
// filter form
|
||
$filter_form = new Filter_form('m');
|
||
|
||
$filter_form->add('name')
|
||
->callback('json/member_name');
|
||
|
||
$filter_form->add('id')
|
||
->type('number');
|
||
|
||
$filter_form->add('applicant_connected_from')
|
||
->type('date')
|
||
->label('Connected from');
|
||
|
||
$filter_form->add('applicant_registration_datetime')
|
||
->type('date')
|
||
->label('Registration time');
|
||
|
||
$filter_form->add('comment');
|
||
|
||
$filter_form->add('registration')
|
||
->type('select')
|
||
->values(arr::bool());
|
||
|
||
$filter_form->add('town')
|
||
->type('select')
|
||
->values(array_unique($town_model->select_list('town', 'town')));
|
||
|
||
$filter_form->add('street')
|
||
->type('select')
|
||
->values(array_unique($street_model->select_list('street', 'street')));
|
||
|
||
$filter_form->add('street_number')
|
||
->type('number');
|
||
|
||
// gets new selector
|
||
if (is_numeric($this->input->post('record_per_page')))
|
||
$limit_results = (int) $this->input->post('record_per_page');
|
||
|
||
// parameters control
|
||
$allowed_order_type = array
|
||
(
|
||
'id', 'registration', 'name', 'street', 'street_number', 'town',
|
||
'applicant_connected_from', 'applicant_registration_datetime',
|
||
'comment'
|
||
);
|
||
|
||
// order by check
|
||
if (!in_array(strtolower($order_by), $allowed_order_type))
|
||
$order_by = 'id';
|
||
|
||
// order by direction check
|
||
if (strtolower($order_by_direction) != 'desc')
|
||
$order_by_direction = 'asc';
|
||
|
||
// load members
|
||
$model_members = new Member_Model();
|
||
$query = $model_members->get_registered_members();
|
||
$total_members = $model_members->count_all_registered_applicants($filter_form->as_sql());
|
||
|
||
// limit check
|
||
if (($sql_offset = ($page - 1) * $limit_results) > $total_members)
|
||
$sql_offset = 0;
|
||
|
||
// query data
|
||
$query = $model_members->get_registered_applicants(
|
||
$sql_offset, $limit_results, $order_by, $order_by_direction,
|
||
$filter_form->as_sql()
|
||
);
|
||
|
||
// path to form
|
||
$path = Config::get('lang') . '/members/applicants/' . $limit_results . '/'
|
||
. $order_by . '/' . $order_by_direction.'/'.$page_word.'/'
|
||
. $page.'/'.$regs;
|
||
|
||
// grid
|
||
$grid = new Grid(url::base(TRUE) . url::current(true), null, array
|
||
$grid = new Grid(null, null, array
|
||
(
|
||
'use_paginator' => false,
|
||
'use_selector' => false
|
||
'current' => $limit_results,
|
||
'selector_increace' => 40,
|
||
'selector_min' => 40,
|
||
'selector_max_multiplier' => 25,
|
||
'base_url' => $path,
|
||
'uri_segment' => 'page',
|
||
'total_items' => $total_members,
|
||
'items_per_page' => $limit_results,
|
||
'style' => 'classic',
|
||
'order_by' => $order_by,
|
||
'order_by_direction' => $order_by_direction,
|
||
'limit_results' => $limit_results,
|
||
'filter' => $filter_form,
|
||
'method' => 'get'
|
||
));
|
||
|
||
// approve applicant checkbox
|
||
$grid->order_form_field('toapprove')
|
||
->callback('callback::member_approve_avaiable')
|
||
->type('checkbox')
|
||
->class('center')
|
||
->label(' ');
|
||
|
||
$grid->form_submit_value = __('Approve selected applicants');
|
||
|
||
// database columns - some are commented out because of lack of space
|
||
$grid->field('id')
|
||
$grid->order_field('id')
|
||
->label('ID');
|
||
|
||
$grid->field('name');
|
||
$grid->order_field('name');
|
||
|
||
$grid->field('street');
|
||
$grid->order_field('street');
|
||
|
||
$grid->field('street_number');
|
||
$grid->order_field('street_number');
|
||
|
||
$grid->field('town');
|
||
$grid->order_field('town');
|
||
|
||
$grid->field('applicant_registration_datetime')
|
||
$grid->order_field('applicant_registration_datetime')
|
||
->label('Registration time');
|
||
|
||
$grid->field('comment');
|
||
$grid->order_field('applicant_connected_from')
|
||
->label('Connected from');
|
||
|
||
$grid->order_callback_field('registration')
|
||
->callback('callback::registration_field');
|
||
|
||
$grid->order_callback_field('comment')
|
||
->callback('callback::limited_text');
|
||
|
||
$actions = $grid->grouped_action_field();
|
||
|
||
... | ... | |
|
||
if ($this->acl_check_edit(get_class($this), 'members'))
|
||
{
|
||
$actions->add_action('id')
|
||
->icon_action('edit')
|
||
->url('members/edit');
|
||
$actions->add_conditional_action('id')
|
||
->condition('is_applicant_registration')
|
||
->icon_action('member')
|
||
->url('members/approve_applicant')
|
||
->label('Approve application for membership')
|
||
->class('popup_link');
|
||
}
|
||
|
||
if ($this->acl_check_delete(get_class($this), 'members'))
|
||
... | ... | |
|
||
// description
|
||
$desc = '<br>' . __(
|
||
'Registered applicants can be approved in edit form by changing their type'
|
||
'Registered applicants can be approved using action button (placed in each line)'
|
||
) . '.<br>'. __(
|
||
'Delete applicants for refusing of their request'
|
||
) . '.';
|
||
) . '.';
|
||
|
||
// view
|
||
$view = new View('main');
|
||
$view->title = $headline;
|
||
$view->breadcrumbs = $breadcrumbs->html();
|
||
$view->content = new View('show_all');
|
||
$view->content->description = $desc;
|
||
$view->content->table = $grid;
|
||
$view->content->headline = $headline;
|
||
$view->render(TRUE);
|
||
if (isset($_GET) && count(@$_GET) && isset($_GET['toapprove']))
|
||
{
|
||
$this->multiple_applicants_details(@$_GET['toapprove']);
|
||
}
|
||
else
|
||
{
|
||
// view
|
||
$view = new View('main');
|
||
$view->title = $headline;
|
||
$view->breadcrumbs = $breadcrumbs->html();
|
||
$view->content = new View('show_all');
|
||
$view->content->description = $desc;
|
||
$view->content->table = $grid;
|
||
$view->content->headline = $headline;
|
||
$view->render(TRUE);
|
||
}
|
||
} // end of registered function
|
||
|
||
|
||
/**
|
||
* Deletes registered applicants
|
||
*
|
||
* @author Ondřej Fibich
|
||
* @param integer $member_id
|
||
* Form for approving multiple members
|
||
*
|
||
* @param array $selected
|
||
*/
|
||
public function delete_applicant($member_id = NULL)
|
||
private function multiple_applicants_details($selected)
|
||
{
|
||
// parameter is wrong
|
||
if (!$member_id || !is_numeric($member_id))
|
||
Controller::warning(PARAMETER);
|
||
|
||
$member = new Member_Model($member_id);
|
||
|
||
// member doesn't exist
|
||
if (!$member->id)
|
||
Controller::error(RECORD);
|
||
|
||
// access control
|
||
if (!$this->acl_check_delete(get_class($this), 'members'))
|
||
if (!$this->acl_check_edit('Variable_Symbols_Controller', 'variable_symbols') ||
|
||
!$this->acl_check_edit(get_class($this), 'qos_ceil') ||
|
||
!$this->acl_check_edit(get_class($this), 'qos_rate'))
|
||
{
|
||
Controller::error(ACCESS);
|
||
}
|
||
|
||
// delete is enabled only on applicants
|
||
if ($member->type != Member_Model::TYPE_APPLICANT)
|
||
Controller::warning(PARAMETER);
|
||
if (!Settings::get('finance_enabled'))
|
||
{
|
||
status::warning('Enable financial module before approving applicants.');
|
||
$this->redirect('members/applicants');
|
||
}
|
||
|
||
// send email with details
|
||
$contact = new Contact_Model();
|
||
$emails = $contact->find_all_users_contacts($member->user->id, Contact_Model::TYPE_EMAIL);
|
||
|
||
if ($emails && $emails->count())
|
||
if (!Variable_Key_Generator::get_active_driver())
|
||
{
|
||
$to = $emails->current()->value;
|
||
$from = Settings::get('email_default_email');
|
||
$subject = 'Registration deny';
|
||
$message = 'Your registration to FreenetIS has been denied';
|
||
|
||
try
|
||
{
|
||
email::send($to, $from, $subject, $message);
|
||
}
|
||
catch (Exception $e)
|
||
{
|
||
status::error(
|
||
__('Error - cannot send email to applicant about deny of membership')
|
||
. '<br>' . __('Error') . ': ' . $e->getMessage(),
|
||
FALSE
|
||
);
|
||
}
|
||
status::warning('Set variable key generator before approving applicants.');
|
||
$this->redirect('members/applicants');
|
||
}
|
||
|
||
// delete user
|
||
foreach ($member->users as $user)
|
||
//form
|
||
$form = new Forge('members/approve_multiple_applicants');
|
||
|
||
$member = new Member_Model();
|
||
$association = new Member_Model(Member_Model::ASSOCIATION);
|
||
|
||
$items = array();
|
||
|
||
// prepare data
|
||
foreach ($selected AS $id)
|
||
{
|
||
$user->delete_depends_items($user->id);
|
||
$user->delete();
|
||
$item = new stdClass();
|
||
$item->id = $id;
|
||
$item->name = $member->find($id)->name;
|
||
$item->registration = $member->find($id)->registration;
|
||
|
||
$items[] = $item;
|
||
|
||
$form->hidden('toapprove['.$item->id.']')
|
||
->value($item->id);
|
||
}
|
||
|
||
// delete account
|
||
$member->delete_accounts($member->id);
|
||
// create form items
|
||
$form->group('Basic information');
|
||
|
||
// delete member
|
||
$member->delete();
|
||
$form->date('entrance_date')
|
||
->label('Entrance date')
|
||
->years(date('Y', strtotime($association->entrance_date)), date('Y'))
|
||
->rules('required')
|
||
->value(time());
|
||
|
||
// redirection to registered applicants
|
||
url::redirect('members/applicants');
|
||
}
|
||
|
||
/**
|
||
* Shows details of member.
|
||
*
|
||
* @param integer $member_id id of member to show
|
||
* @param string $order_by sorting column
|
||
* @param string $order_by_direction sorting direction
|
||
*/
|
||
public function show(
|
||
$member_id = NULL, $limit_results = 20, $order_by = 'ip_address',
|
||
$order_by_direction = 'ASC', $page_word = null, $page = 1)
|
||
{
|
||
// parameter is wrong
|
||
if (!$member_id || !is_numeric($member_id))
|
||
Controller::warning(PARAMETER);
|
||
|
||
$this->member = $member = new Member_Model($member_id);
|
||
|
||
// member doesn't exist
|
||
if (!$member->id)
|
||
Controller::error(RECORD);
|
||
$speed_class = new Speed_class_Model();
|
||
$speed_classes = array(NULL => '') + $speed_class->select_list();
|
||
$def_speed_class = $speed_class->get_members_default_class();
|
||
|
||
$form->dropdown('speed_class')
|
||
->options($speed_classes)
|
||
->selected($def_speed_class ? $def_speed_class->id : NULL)
|
||
->add_button('speed_classes')
|
||
->style('width:200px');
|
||
|
||
$form->submit('Approve');
|
||
|
||
//description
|
||
$desc = __('Variable symbol will be automaticaly generated for every applicant.');
|
||
|
||
//grid
|
||
$grid = new Grid('members', __('Selected applicants'), array
|
||
(
|
||
'use_paginator' => false,
|
||
'use_selector' => false
|
||
));
|
||
|
||
$grid->order_field('name');
|
||
|
||
$grid->order_callback_field('registration')
|
||
->callback('callback::registration_field');
|
||
|
||
$grid->datasource($items);
|
||
|
||
// headline
|
||
$headline = __('Approve selected applicants');
|
||
|
||
// breadcrumbs navigation
|
||
$breadcrumbs = breadcrumbs::add()
|
||
->link('members/show_all', 'Members',
|
||
$this->acl_check_view(get_class($this),'members'))
|
||
->link('members/applicants', 'Registered applicants',
|
||
$this->acl_check_view(get_class($this),'members'))
|
||
->text($headline);
|
||
|
||
// view
|
||
$view = new View('main');
|
||
$view->title = $headline;
|
||
$view->breadcrumbs = $breadcrumbs->html();
|
||
$view->content = new View('show_all');
|
||
$view->content->table = $grid;
|
||
$view->content->form = $form;
|
||
$view->content->description = $desc;
|
||
$view->content->headline = $headline;
|
||
$view->render(TRUE);
|
||
}
|
||
|
||
/**
|
||
* Approves multiple applicants
|
||
*
|
||
* @throws Exception
|
||
*/
|
||
public function approve_multiple_applicants()
|
||
{
|
||
if (!$this->acl_check_edit('Variable_Symbols_Controller', 'variable_symbols') ||
|
||
!$this->acl_check_edit(get_class($this), 'qos_ceil') ||
|
||
!$this->acl_check_edit(get_class($this), 'qos_rate'))
|
||
{
|
||
Controller::error(ACCESS);
|
||
}
|
||
|
||
if (!isset($_POST) || !isset($_POST['toapprove']) || !isset($_POST['entrance_date']) ||
|
||
!isset($_POST['speed_class']))
|
||
{
|
||
Controller::error(PARAMETER);
|
||
}
|
||
|
||
$approved_count = 0;
|
||
$selected = @$_POST['toapprove'];
|
||
$date = @$_POST['entrance_date'];
|
||
$speed_class = @$_POST['speed_class'];
|
||
|
||
// approve selected applicants
|
||
foreach ($selected AS $applicant_id)
|
||
{
|
||
$member = new Member_Model($applicant_id);
|
||
|
||
try
|
||
{
|
||
$member->transaction_start();
|
||
|
||
// change member
|
||
$member->entrance_date = $date;
|
||
|
||
// get members account
|
||
$account = ORM::factory('account')->where(array
|
||
(
|
||
'member_id' => $member->id,
|
||
'account_attribute_id' => Account_attribute_Model::CREDIT
|
||
))->find();
|
||
|
||
// generate variable symbol
|
||
$var_sym = Variable_Key_Generator::factory()->generate($member->id);
|
||
|
||
$vs = new Variable_Symbol_Model();
|
||
|
||
$vs_not_unique = $vs->get_variable_symbol_id($var_sym);
|
||
|
||
if ($vs_not_unique && $vs_not_unique->id)
|
||
{
|
||
if ($vs_not_unique->account_id != $account->id)
|
||
{
|
||
throw new Exception(__('Variable symbol already exists in database.'));
|
||
}
|
||
}
|
||
else
|
||
{
|
||
$vs->account_id = $account->id;
|
||
$vs->variable_symbol = $var_sym;
|
||
$vs->save_throwable();
|
||
}
|
||
|
||
// set speed class
|
||
$member->speed_class_id = $speed_class;
|
||
|
||
// unlock and set to Regular member
|
||
$member->type = Member_Model::TYPE_REGULAR;
|
||
$member->locked = 0;
|
||
|
||
$member->save_throwable();
|
||
|
||
// access rights
|
||
$group_aro_map = new Groups_aro_map_Model();
|
||
|
||
// get main user
|
||
$main_user_id = NULL;
|
||
|
||
foreach ($member->users as $user)
|
||
{
|
||
if ($user->type == User_Model::MAIN_USER)
|
||
{
|
||
$main_user_id = $user->id;
|
||
break;
|
||
}
|
||
}
|
||
|
||
if (!$main_user_id)
|
||
throw new Exception('Main user of applicant is missing');
|
||
|
||
// if is not member yet
|
||
if (!$group_aro_map->exist_row(
|
||
Aro_group_Model::REGULAR_MEMBERS, $main_user_id
|
||
))
|
||
{
|
||
// delete rights of applicant
|
||
$group_aro_map->detete_row(
|
||
Aro_group_Model::REGISTERED_APPLICANTS, $main_user_id
|
||
);
|
||
|
||
// insert regular member access rights
|
||
$groups_aro_map = new Groups_aro_map_Model();
|
||
$groups_aro_map->aro_id = $main_user_id;
|
||
$groups_aro_map->group_id = Aro_group_Model::REGULAR_MEMBERS;
|
||
$groups_aro_map->save_throwable();
|
||
|
||
// reload messages
|
||
ORM::factory('member')->reactivate_messages($applicant_id);
|
||
|
||
// inform new member
|
||
if (module::e('notification'))
|
||
{
|
||
Message_Model::activate_special_notice(
|
||
Message_Model::APPLICANT_APPROVE_MEMBERSHIP,
|
||
$member->id, $this->session->get('user_id'),
|
||
Notifications_Controller::ACTIVATE,
|
||
Notifications_Controller::KEEP
|
||
);
|
||
}
|
||
|
||
$member->transaction_commit();
|
||
}
|
||
|
||
$approved_count++;
|
||
}
|
||
catch (Exception $e)
|
||
{
|
||
Log::add_exception($e);
|
||
$member->transaction_rollback();
|
||
// error
|
||
status::error('Applicant for membership cannot be approved', $e);
|
||
}
|
||
}
|
||
|
||
status::info('Applicants for membership accepted (%d / %d)', TRUE, array($approved_count, count($selected)));
|
||
|
||
$this->redirect('members/applicants');
|
||
}
|
||
|
||
/**
|
||
* Form for approving of member
|
||
*
|
||
* @author Ondřej Fibich
|
||
* @see #369
|
||
* @param integer $member_id
|
||
*/
|
||
public function approve_applicant($member_id = NULL)
|
||
{
|
||
// parameter is wrong
|
||
if (!$member_id || !is_numeric($member_id))
|
||
Controller::warning(PARAMETER);
|
||
|
||
$association = new Member_Model(Member_Model::ASSOCIATION);
|
||
$member = new Member_Model($member_id);
|
||
|
||
if (!condition::is_applicant_registration($member))
|
||
{
|
||
self::error(RECORD);
|
||
}
|
||
|
||
if (Settings::get('finance_enabled'))
|
||
{
|
||
$member_fee = new Members_fee_Model();
|
||
|
||
$additional_payment_amount = $member_fee->calculate_additional_payment_of_applicant(
|
||
$member->applicant_connected_from, date('Y-m-d')
|
||
);
|
||
}
|
||
|
||
// member doesn't exist
|
||
if (!$member->id)
|
||
Controller::error(RECORD);
|
||
|
||
// access control
|
||
if (!$this->acl_check_new(get_class($this), 'members') ||
|
||
!$this->acl_check_edit(get_class($this), 'entrance_date') ||
|
||
!$this->acl_check_new('Accounts_Controller', 'transfers'))
|
||
Controller::error(ACCESS);
|
||
|
||
// delete is enabled only on applicants
|
||
if ($member->type != Member_Model::TYPE_APPLICANT)
|
||
Controller::warning(PARAMETER);
|
||
|
||
// form
|
||
$form = new Forge();
|
||
|
||
$form->group('Basic information');
|
||
|
||
$form->date('entrance_date')
|
||
->label('Entrance date')
|
||
->years(date('Y', strtotime($association->entrance_date)), date('Y'))
|
||
->rules('required')
|
||
->value(time());
|
||
|
||
if ($this->acl_check_edit(get_class($this), 'registration'))
|
||
{
|
||
$form->dropdown('registration')
|
||
->options(arr::rbool())
|
||
->selected($member->registration);
|
||
}
|
||
|
||
if (Settings::get('finance_enabled') &&
|
||
$this->acl_check_edit('Variable_Symbols_Controller', 'variable_symbols'))
|
||
{
|
||
$form->input('variable_symbol')
|
||
->rules('length[1,10]')
|
||
->class('join1')
|
||
->callback('Variable_Symbols_Controller::valid_var_sym')
|
||
->style('width:120px');
|
||
|
||
if (Variable_Key_Generator::get_active_driver())
|
||
{
|
||
$form->checkbox('variable_symbol_generate')
|
||
->label('Generate automatically')
|
||
->checked(TRUE)
|
||
->class('join2')
|
||
->style('width:auto;margin-left:5px');
|
||
}
|
||
}
|
||
|
||
if ($this->acl_check_edit(get_class($this), 'qos_ceil') &&
|
||
$this->acl_check_edit(get_class($this), 'qos_rate'))
|
||
{
|
||
$speed_class = new Speed_class_Model();
|
||
$speed_classes = array(NULL => '') + $speed_class->select_list();
|
||
$def_speed_class = $speed_class->get_members_default_class();
|
||
|
||
$form->dropdown('speed_class')
|
||
->options($speed_classes)
|
||
->selected($def_speed_class ? $def_speed_class->id : $member->id)
|
||
->add_button('speed_classes')
|
||
->style('width:200px');
|
||
}
|
||
|
||
if ($this->acl_check_edit(get_class($this), 'comment'))
|
||
{
|
||
$form->textarea('comment')
|
||
->rules('length[0,250]')
|
||
->value($member->comment);
|
||
}
|
||
|
||
if (Settings::get('finance_enabled') &&
|
||
Settings::get('self_registration_enable_additional_payment'))
|
||
{
|
||
$form->group(__('Additional demolition of membership fees') . ' ' . help::hint('applicant_additional_payment'));
|
||
|
||
$form->checkbox('allow_additional_payment')
|
||
->label('Allow additional payment')
|
||
->value(1);
|
||
|
||
$form->input('connection_payment_amount')
|
||
->label('Amount')
|
||
->value($additional_payment_amount)
|
||
->style('width: 70px');
|
||
}
|
||
|
||
$form->submit('Approve');
|
||
|
||
// sended
|
||
if ($form->validate())
|
||
{
|
||
try
|
||
{
|
||
$member->transaction_start();
|
||
|
||
$form_data = $form->as_array();
|
||
|
||
// change member
|
||
$member->entrance_date = date('Y-m-d', $form_data['entrance_date']);
|
||
|
||
if ($this->acl_check_edit('Members_Controller', 'registration'))
|
||
{
|
||
$member->registration = $form_data['registration'];
|
||
}
|
||
|
||
if ($this->acl_check_edit(get_class($this), 'comment'))
|
||
{
|
||
$member->comment = $form_data['comment'];
|
||
}
|
||
|
||
if ($this->acl_check_edit('Variable_Symbols_Controller', 'variable_symbols') &&
|
||
(!empty($form_data['variable_symbol']) || (
|
||
isset($form_data['variable_symbol_generate']) &&
|
||
$form_data['variable_symbol_generate']
|
||
)))
|
||
{
|
||
$account = ORM::factory('account')->where(array
|
||
(
|
||
'member_id' => $member->id,
|
||
'account_attribute_id' => Account_attribute_Model::CREDIT
|
||
))->find();
|
||
|
||
if (!isset($form_data['variable_symbol_generate']) ||
|
||
!$form_data['variable_symbol_generate'])
|
||
{
|
||
$var_sym = $form_data['variable_symbol'];
|
||
}
|
||
else
|
||
{
|
||
$var_sym = Variable_Key_Generator::factory()->generate($member->id);
|
||
}
|
||
|
||
$vs = new Variable_Symbol_Model();
|
||
|
||
$vs_not_unique = $vs->get_variable_symbol_id($var_sym);
|
||
|
||
if ($vs_not_unique && $vs_not_unique->id)
|
||
{
|
||
if ($vs_not_unique->account_id != $account->id)
|
||
{
|
||
throw new Exception(__('Variable symbol already exists in database.'));
|
||
}
|
||
}
|
||
else
|
||
{
|
||
$vs->account_id = $account->id;
|
||
$vs->variable_symbol = $var_sym;
|
||
$vs->save_throwable();
|
||
}
|
||
}
|
||
|
||
if ($this->acl_check_edit(get_class($this), 'qos_ceil') &&
|
||
$this->acl_check_edit(get_class($this), 'qos_rate'))
|
||
{
|
||
$member->speed_class_id = $form_data['speed_class'];
|
||
}
|
||
|
||
$member->type = Member_Model::TYPE_REGULAR;
|
||
$member->locked = 0;
|
||
|
||
$member->save_throwable();
|
||
|
||
// access rights
|
||
$group_aro_map = new Groups_aro_map_Model();
|
||
|
||
// get main user
|
||
$main_user_id = NULL;
|
||
|
||
foreach ($member->users as $user)
|
||
{
|
||
if ($user->type == User_Model::MAIN_USER)
|
||
{
|
||
$main_user_id = $user->id;
|
||
break;
|
||
}
|
||
}
|
||
|
||
if (!$main_user_id)
|
||
throw new Exception('Main user of applicant is missing');
|
||
|
||
// if is not member yet
|
||
if (!$group_aro_map->exist_row(
|
||
Aro_group_Model::REGULAR_MEMBERS, $main_user_id
|
||
))
|
||
{
|
||
// delete rights of applicant
|
||
$group_aro_map->detete_row(
|
||
Aro_group_Model::REGISTERED_APPLICANTS, $main_user_id
|
||
);
|
||
|
||
// insert regular member access rights
|
||
$groups_aro_map = new Groups_aro_map_Model();
|
||
$groups_aro_map->aro_id = $main_user_id;
|
||
$groups_aro_map->group_id = Aro_group_Model::REGULAR_MEMBERS;
|
||
$groups_aro_map->save_throwable();
|
||
}
|
||
|
||
// make transfer for connection
|
||
if (isset($form_data['allow_additional_payment']) &&
|
||
$form_data['allow_additional_payment'] &&
|
||
($form_data['connection_payment_amount'] > 0))
|
||
{
|
||
$operating_account = ORM::factory('account')
|
||
->where('account_attribute_id', Account_attribute_Model::OPERATING)
|
||
->find();
|
||
|
||
$credit_account = ORM::factory('account')->where(array
|
||
(
|
||
'member_id' => $member->id,
|
||
'account_attribute_id' => Account_attribute_Model::CREDIT
|
||
))->find();
|
||
|
||
Transfer_Model::insert_transfer(
|
||
$credit_account->id, $operating_account->id, null,
|
||
null, $this->session->get('user_id'),
|
||
null, $member->entrance_date,
|
||
date('Y-m-d H:i:s'),
|
||
__('Additional payment for member fees before membership'),
|
||
$form_data['connection_payment_amount']
|
||
);
|
||
}
|
||
|
||
// reload messages of worker
|
||
ORM::factory('member')->reactivate_messages($member_id);
|
||
|
||
// inform new member
|
||
if (module::e('notification'))
|
||
{
|
||
Message_Model::activate_special_notice(
|
||
Message_Model::APPLICANT_APPROVE_MEMBERSHIP,
|
||
$member->id, $this->session->get('user_id'),
|
||
Notifications_Controller::ACTIVATE,
|
||
Notifications_Controller::KEEP
|
||
);
|
||
}
|
||
|
||
unset($form_data);
|
||
|
||
$member->transaction_commit();
|
||
|
||
$this->redirect('members/show', $member_id);
|
||
}
|
||
catch (Exception $e)
|
||
{
|
||
Log::add_exception($e);
|
||
$member->transaction_rollback();
|
||
// error
|
||
status::error('Applicant for membership cannot be approved', $e);
|
||
}
|
||
}
|
||
|
||
$headline = __('Approve application for membership');
|
||
|
||
// breadcrumbs navigation
|
||
$breadcrumbs = breadcrumbs::add()
|
||
->link('members/show_all', 'Members',
|
||
$this->acl_check_view(get_class($this), 'members'))
|
||
->disable_translation()
|
||
->link('members/show/'.$member->id,
|
||
"ID $member->id - $member->name",
|
||
$this->acl_check_view(get_class($this), 'members', $member->id)
|
||
)->text($headline);
|
||
|
||
// view
|
||
$view = new View('main');
|
||
$view->breadcrumbs = $breadcrumbs->html();
|
||
$view->title = $headline;
|
||
$view->content = new View('form');
|
||
$view->content->headline = $headline;
|
||
$view->content->form = $form->html();
|
||
$view->content->link_back = '';
|
||
$view->render(TRUE);
|
||
}
|
||
|
||
/**
|
||
* Deletes registered applicants
|
||
*
|
||
* @author Ondřej Fibich
|
||
* @param integer $member_id
|
||
*/
|
||
public function delete_applicant($member_id = NULL)
|
||
{
|
||
// parameter is wrong
|
||
if (!$member_id || !is_numeric($member_id))
|
||
Controller::warning(PARAMETER);
|
||
|
||
$member = new Member_Model($member_id);
|
||
|
||
// member doesn't exist
|
||
if (!$member->id)
|
||
Controller::error(RECORD);
|
||
|
||
// access control
|
||
if (!$this->acl_check_delete(get_class($this), 'members'))
|
||
Controller::error(ACCESS);
|
||
|
||
// delete is enabled only on applicants
|
||
if ($member->type != Member_Model::TYPE_APPLICANT)
|
||
Controller::warning(PARAMETER);
|
||
|
||
// send notice with details
|
||
if (module::e('notification'))
|
||
{
|
||
Message_Model::activate_special_notice(
|
||
Message_Model::APPLICANT_REFUSE_MEMBERSHIP,
|
||
$member->id, $this->session->get('user_id'),
|
||
Notifications_Controller::ACTIVATE,
|
||
Notifications_Controller::KEEP
|
||
);
|
||
}
|
||
|
||
// delete user
|
||
foreach ($member->users as $user)
|
||
{
|
||
$user->delete_depends_items($user->id);
|
||
$user->delete();
|
||
}
|
||
|
||
// delete account
|
||
$member->delete_accounts($member->id);
|
||
|
||
// delete member
|
||
$member->delete();
|
||
|
||
// redirection to registered applicants
|
||
url::redirect('members/applicants');
|
||
}
|
||
|
||
/**
|
||
* Shows details of member.
|
||
*
|
||
* @param integer $member_id id of member to show
|
||
* @param string $order_by sorting column
|
||
* @param string $order_by_direction sorting direction
|
||
*/
|
||
public function show(
|
||
$member_id = NULL, $limit_results = 20, $order_by = 'ip_address',
|
||
$order_by_direction = 'ASC', $page_word = null, $page = 1)
|
||
{
|
||
// parameter is wrong
|
||
if (!$member_id || !is_numeric($member_id))
|
||
Controller::warning(PARAMETER);
|
||
|
||
$this->member = $member = new Member_Model($member_id);
|
||
|
||
// member doesn't exist
|
||
if (!$member->id)
|
||
Controller::error(RECORD);
|
||
|
||
$membership_transfer_model = new Membership_transfer_Model();
|
||
|
||
// test if member is association itself
|
||
$is_association = ($member->id == Member_Model::ASSOCIATION);
|
||
|
||
// test if member is former member
|
||
$is_former = ($member->type == Member_Model::TYPE_FORMER);
|
||
|
||
// test if member is applicant
|
||
$is_applicant = ($member->type == Member_Model::TYPE_APPLICANT);
|
||
|
||
// member is former member
|
||
if ($is_former)
|
||
{
|
||
// find possible membership transfer from member
|
||
$membership_transfer_from_member = $membership_transfer_model
|
||
->get_transfer_from_member($member->id);
|
||
}
|
||
|
||
// find possible membership transfer to member
|
||
$membership_transfer_to_member = $membership_transfer_model
|
||
->get_transfer_to_member($member->id);
|
||
|
||
// access control
|
||
if (!$this->acl_check_view(get_class($this), 'members', $member->id))
|
||
... | ... | |
// has member active membership interrupt?
|
||
$active_interrupt = ORM::factory('membership_interrupt')
|
||
->has_member_interrupt_in_date($member->id, date('Y-m-d'));
|
||
|
||
$end_membership = ORM::factory('membership_interrupt')
|
||
->has_member_end_after_interrupt_end_in_date($member->id, date('Y-m-d'));
|
||
|
||
$flags = array();
|
||
|
||
if ($active_interrupt)
|
||
{
|
||
$flags[] = __('I');
|
||
}
|
||
|
||
if ($end_membership)
|
||
{
|
||
$flags[] = __('E');
|
||
}
|
||
|
||
$title = ($active_interrupt) ? $type . ' '.$member->name
|
||
. ' ('. __('I') .')' : $type . ' '.$member->name;
|
||
$title = ($flags) ? $type . ' '.$member->name
|
||
. ' ('. implode(' + ', $flags) .')' : $type . ' '.$member->name;
|
||
|
||
if ($is_applicant &&
|
||
condition::is_applicant_registration($member) &&
|
||
$this->acl_check_edit(get_class($this), 'members', $member->id))
|
||
{
|
||
$title .= ' <small style="font-size: 60%; font-weight: normal">(' . html::anchor(
|
||
'members/approve_applicant/' . $member_id,
|
||
__('Approve application for membership'),
|
||
array('class' => 'popup_link')
|
||
) . ')</small>';
|
||
}
|
||
|
||
// finds credit account of member
|
||
if ($member->id != 1)
|
||
if (Settings::get('finance_enabled') && !$is_association)
|
||
{
|
||
$account = ORM::factory('account')->where(array
|
||
(
|
||
'member_id' => $member_id,
|
||
'account_attribute_id' => Account_attribute_Model::CREDIT
|
||
))->find();
|
||
|
||
if (!$is_former)
|
||
{
|
||
// find current regular member fee of member
|
||
$fee = ORM::factory('fee')->get_regular_member_fee_by_member_date(
|
||
$member->id,
|
||
date('Y-m-d')
|
||
);
|
||
}
|
||
|
||
$entrance_fee_paid = ORM::factory('transfer')->count_entrance_fee_transfers_of_account($account->id);
|
||
$entrance_fee_left = $member->entrance_fee - $entrance_fee_paid;
|
||
}
|
||
|
||
// gps coordinates
|
||
... | ... | |
}
|
||
|
||
/******** VoIP ***********/
|
||
|
||
// VoIP SIP model
|
||
$voip_sip = new Voip_sip_Model();
|
||
// Gets sips
|
||
$voip = $voip_sip->get_all_record_by_member_limited($member->id);
|
||
// Has driver?
|
||
$has_driver = Billing::instance()->has_driver();
|
||
// Account
|
||
$b_account = null;
|
||
// Check account only if have SIP
|
||
if ($voip->count())
|
||
|
||
if (Settings::get('voip_enabled'))
|
||
{
|
||
$b_account = Billing::instance()->get_account($member->id);
|
||
}
|
||
// VoIP SIP model
|
||
$voip_sip = new Voip_sip_Model();
|
||
// Gets sips
|
||
$voip = $voip_sip->get_all_record_by_member_limited($member->id);
|
||
// Has driver?
|
||
$has_driver = Billing::instance()->has_driver();
|
||
// Account
|
||
$b_account = null;
|
||
// Check account only if have SIP
|
||
if ($voip->count())
|
||
{
|
||
$b_account = Billing::instance()->get_account($member->id);
|
||
}
|
||
|
||
$voip_grid = new Grid('members', null, array
|
||
(
|
||
'separator' => '<br /><br />',
|
||
'use_paginator' => false,
|
||
'use_selector' => false
|
||
));
|
||
$voip_grid = new Grid('members', null, array
|
||
(
|
||
'separator' => '<br /><br />',
|
||
'use_paginator' => false,
|
||
'use_selector' => false
|
||
));
|
||
|
||
$voip_grid->field('id')
|
||
->label('ID');
|
||
|
||
$voip_grid->field('callerid')
|
||
->label(__('Number'));
|
||
|
||
$actions = $voip_grid->grouped_action_field();
|
||
|
||
$voip_grid->field('id')
|
||
->label('ID');
|
||
|
||
$voip_grid->field('callerid')
|
||
->label(__('Number'));
|
||
|
||
$actions = $voip_grid->grouped_action_field();
|
||
|
||
$actions->add_action('user_id')
|
||
->icon_action('phone')
|
||
->url('voip/show')
|
||
->label('Show VoIP account');
|
||
|
||
$actions->add_action('user_id')
|
||
->icon_action('member')
|
||
->url('users/show')
|
||
->label('Show user who own this VoIP account');
|
||
|
||
$voip_grid->datasource($voip);
|
||
if ($this->acl_check_view('VoIP_Controller', 'voip', $member->id))
|
||
{
|
||
$actions->add_action('user_id')
|
||
->icon_action('phone')
|
||
->url('voip/show')
|
||
->label('Show VoIP account');
|
||
}
|
||
|
||
if ($has_driver && $b_account)
|
||
{
|
||
$voip_grid->add_new_button(
|
||
'voip_calls/show_by_member/'.$member->id,
|
||
__('List of all calls')
|
||
);
|
||
if ($this->acl_check_view('Users_Controller', 'users', $member->id))
|
||
{
|
||
$actions->add_action('user_id')
|
||
->icon_action('member')
|
||
->url('users/show')
|
||
->label('Show user who own this VoIP account');
|
||
}
|
||
|
||
if ($member->id != 1)
|
||
$voip_grid->datasource($voip);
|
||
|
||
if ($has_driver && $b_account)
|
||
{
|
||
$voip_grid->add_new_button(
|
||
'transfers/add_voip/'.$account->id,
|
||
__('Recharge VoIP credit')
|
||
);
|
||
if ($this->acl_check_view('VoIP_Controller', 'voip', $member->id))
|
||
{
|
||
$voip_grid->add_new_button(
|
||
'voip_calls/show_by_member/'.$member->id,
|
||
__('List of all calls')
|
||
);
|
||
}
|
||
|
||
if (Settings::get('finance_enabled') &&
|
||
$this->acl_check_new('Accounts_Controller', 'transfers', $member->id) &&
|
||
!$is_association)
|
||
{
|
||
$voip_grid->add_new_button(
|
||
'transfers/add_voip/'.$account->id,
|
||
__('Recharge VoIP credit')
|
||
);
|
||
}
|
||
}
|
||
}
|
||
|
||
// finds date of expiration of member fee
|
||
$expiration_date = (isset($account)) ? self::get_expiration_date($account) : '';
|
||
$expiration_date = '';
|
||
|
||
if (Settings::get('finance_enabled') &&
|
||
isset($account) && !$is_applicant && !$is_former)
|
||
{
|
||
$expiration_date = self::get_expiration_date($account);
|
||
}
|
||
|
||
// finds total traffic of member
|
||
if (Settings::get('ulogd_enabled'))
|
||
... | ... | |
$contact_model = new Contact_Model();
|
||
$enum_type_model = new Enum_type_Model();
|
||
|
||
$variable_symbol_model = new Variable_Symbol_Model();
|
||
|
||
// contacts of main user of member
|
||
$contacts = $contact_model->find_all_users_contacts($user->id);
|
||
|
||
$variable_symbols = 0;
|
||
if ($member_id != 1)
|
||
if (Settings::get('finance_enabled'))
|
||
{
|
||
$variable_symbols = $variable_symbol_model->find_account_variable_symbols($account->id);
|
||
$variable_symbol_model = new Variable_Symbol_Model();
|
||
|
||
$variable_symbols = 0;
|
||
if ($member_id != 1)
|
||
{
|
||
$variable_symbols = $variable_symbol_model->find_account_variable_symbols($account->id);
|
||
}
|
||
}
|
||
|
||
$contact_types = array();
|
||
... | ... | |
|
||
$actions = $users_grid->grouped_action_field();
|
||
|
||
if($this->acl_check_view('Users_Controller', 'users', $member_id))
|
||
if ($this->acl_check_view('Users_Controller', 'users', $member_id))
|
||
{
|
||
$actions->add_action('id')
|
||
->icon_action('show')
|
||
... | ... | |
->label('Show devices');
|
||
}
|
||
|
||
if ($this->acl_check_edit('Users_Controller', 'work', $member_id))
|
||
if (Settings::get('works_enabled') &&
|
||
$this->acl_check_edit('Works_Controller', 'work', $member_id))
|
||
{
|
||
$actions->add_action('id')
|
||
->icon_action('work')
|
||
... | ... | |
$users_grid->datasource($users);
|
||
|
||
// membership interrupts
|
||
$membership_interrupts = ORM::factory('membership_interrupt')->get_all_by_member($member_id);
|
||
|
||
$membership_interrupts_grid = new Grid('members', null, array
|
||
(
|
||
'separator' => '<br /><br />',
|
||
'use_paginator' => false,
|
||
'use_selector' => false,
|
||
));
|
||
|
||
if ($this->acl_check_new(get_class($this), 'membership_interrupts', $member_id))
|
||
if (Settings::get('membership_interrupt_enabled'))
|
||
{
|
||
$membership_interrupts_grid->add_new_button(
|
||
'membership_interrupts/add/'.$member_id,
|
||
__('Add new interrupt of membership'),
|
||
array
|
||
(
|
||
'title' => __('Add new interrupt of membership'),
|
||
'class' => 'popup_link'
|
||
)
|
||
);
|
||
}
|
||
$membership_interrupts = ORM::factory('membership_interrupt')->get_all_by_member($member_id);
|
||
|
||
$membership_interrupts_grid->field('id')
|
||
->label('ID');
|
||
|
||
$membership_interrupts_grid->field('from')
|
||
->label(__('Date from'));
|
||
|
||
$membership_interrupts_grid->field('to')
|
||
->label(__('Date to'));
|
||
|
||
$membership_interrupts_grid->field('comment');
|
||
|
||
$actions = $membership_interrupts_grid->grouped_action_field();
|
||
$membership_interrupts_grid = new Grid('members', null, array
|
||
(
|
||
'separator' => '<br /><br />',
|
||
'use_paginator' => false,
|
||
'use_selector' => false,
|
||
));
|
||
|
||
if ($this->acl_check_edit(get_class($this), 'membership_interrupts', $member_id))
|
||
{
|
||
$actions->add_action('id')
|
||
->icon_action('edit')
|
||
->url('membership_interrupts/edit')
|
||
->class('popup_link');
|
||
}
|
||
if ($this->acl_check_new(get_class($this), 'membership_interrupts', $member_id))
|
||
{
|
||
$membership_interrupts_grid->add_new_button(
|
||
'membership_interrupts/add/'.$member_id,
|
||
__('Add new interrupt of membership'),
|
||
array
|
||
(
|
||
'title' => __('Add new interrupt of membership'),
|
||
'class' => 'popup_link'
|
||
)
|
||
);
|
||
}
|
||
|
||
if ($this->acl_check_delete(get_class($this), 'membership_interrupts'))
|
||
{
|
||
$actions->add_action('id')
|
||
->icon_action('delete')
|
||
->url('membership_interrupts/delete')
|
||
->class('delete_link');
|
||
}
|
||
|
||
$membership_interrupts_grid->datasource($membership_interrupts);
|
||
$membership_interrupts_grid->field('id')
|
||
->label('ID');
|
Také k dispozici: Unified diff
Release 1.1.0