Exemplo n.º 1
0
 public function configure()
 {
     $this->widgetSchema['users_group_id'] = new sfWidgetFormChoice(array('choices' => UsersGroups::getChoicesByType()), array('onChange' => 'set_extra_fields_per_group(this.value)'));
     $this->widgetSchema['active'] = new sfWidgetFormInputCheckbox(array(), array('value' => 1));
     $this->setDefault('active', 1);
     $this->widgetSchema['notify'] = new sfWidgetFormInputCheckbox(array(), array('value' => 1));
     $this->setDefault('notify', 1);
     $this->setValidator('notify', new sfValidatorString(array('required' => false)));
     $this->widgetSchema['remove_photo'] = new sfWidgetFormInputCheckbox(array(), array('value' => 1));
     $this->setDefault('remove_photo', 0);
     $this->setValidator('remove_photo', new sfValidatorString(array('required' => false)));
     $this->widgetSchema['photo'] = new sfWidgetFormInputFile();
     $this->widgetSchema['photo_preview'] = new sfWidgetFormInputHidden();
     $this->setValidator('photo_preview', new sfValidatorString(array('required' => false)));
     $this->widgetSchema['name']->setAttributes(array('size' => '40', 'class' => 'required'));
     $this->widgetSchema['email']->setAttributes(array('size' => '40', 'class' => 'required'));
     if ($this->getObject()->isNew()) {
         $this->widgetSchema['password'] = new sfWidgetFormInputPassword();
         $this->widgetSchema['password']->setAttributes(array('class' => 'required'));
     } else {
         unset($this->widgetSchema['password']);
         unset($this->validatorSchema['password']);
         $this->widgetSchema['new_password'] = new sfWidgetFormInputPassword();
         $this->setValidator('new_password', new sfValidatorString(array('required' => false)));
         $this->setDefault('photo_preview', $this->getObject()->getPhoto());
     }
     $this->widgetSchema['culture'] = new sfWidgetFormI18nChoiceLanguage(array('languages' => app::getLanguageCodes()));
     $this->setDefault('culture', sfConfig::get('sf_default_culture'));
     $this->widgetSchema->setLabels(array('users_group_id' => 'Group', 'name' => 'Full Name', 'remove_photo' => 'Remove Photo', 'new_password' => 'New Password', 'culture' => 'Language', 'default_home_page' => 'Start Page', 'active' => 'Active?', 'notify' => 'send login details to user'));
     unset($this->widgetSchema['skin']);
     unset($this->validatorSchema['skin']);
 }
Exemplo n.º 2
0
 public function executeDelete(sfWebRequest $request)
 {
     $this->forward404Unless($this->users_groups = Doctrine_Core::getTable('UsersGroups')->find(array($request->getParameter('id'))), sprintf('Object users_groups does not exist (%s).', $request->getParameter('id')));
     $this->count_users = UsersGroups::countUsersByGroupId($request->getParameter('id'));
     if ($request->isMethod(sfRequest::PUT) and $this->count_users == 0) {
         $this->users_groups->delete();
         $this->getUser()->setFlash('userNotices', t::__('User Group Deleted'));
         $this->redirect('usersGroups/index');
     }
 }
 /**
  * AdminAddUserController::postAddUsers()
  *
  * @return
  */
 public function postAddUsers()
 {
     $messages = array();
     $this->userAccountService = new UserAccountService();
     $rules = array('first_name' => $this->userAccountService->getValidatorRule('first_name'), 'last_name' => $this->userAccountService->getValidatorRule('last_name'), 'email' => $this->userAccountService->getValidatorRule('email'), 'password' => $this->userAccountService->getValidatorRule('password'));
     $validator = \Validator::make(\Input::all(), $rules, $messages);
     if ($validator->passes()) {
         $input = \Input::all();
         $user_id = $this->userAccountService->addNewUser($input, false, true);
         if ($user_id) {
             $group_exists = UsersGroups::whereRaw('user_id = ?', array($user_id))->count('user_id');
             if ($group_exists == 0) {
                 UsersGroups::insert(array('user_id' => $user_id, 'group_id' => 0));
             }
             \Session::flash('success', \Lang::get('webshopauthenticate::admin/addMember.member_add_success'));
             return \Redirect::to(\Config::get('webshopauthenticate::admin_uri'));
         }
     } else {
         return \Redirect::to(\Config::get('webshopauthenticate::admin_uri') . '/users/add')->withInput()->withErrors($validator);
     }
 }
 /**
  * AdminUserController::postSignup()
  *
  * @return
  */
 public function postSignup()
 {
     $userService = new UserAccountService();
     $rules = array('email' => 'required|between:10,40|email|unique:users', 'first_name' => $userService->getValidatorRule('first_name'), 'last_name' => $userService->getValidatorRule('last_name'), 'password' => $userService->getValidatorRule('password'), 'password_confirmation' => 'Required|same:password');
     $validator = \Validator::make(\Input::all(), $rules);
     if ($validator->fails()) {
         return \Redirect::to(\Config::get('webshopauthenticate::uri') . '/signup')->with('errors', $validator->messages())->withInput(\Input::except('password'));
     } else {
         $user_id = $userService->addNewUser(\Input::all());
         if ($user_id) {
             $group_exists = UsersGroups::whereRaw('user_id = ?', array($user_id))->count('user_id');
             if ($group_exists == 0) {
                 UsersGroups::insert(array('user_id' => $user_id, 'group_id' => 0));
             }
         }
         if (\Config::get('webshopauthenticate::user_auto_activate')) {
             return \Redirect::to(\Config::get('webshopauthenticate::uri') . '/login')->with('success_message', 'account_created');
         } else {
             return \View::make('webshopauthenticate::users.signup')->with('success', 1)->with('email', \Input::get('email'));
         }
     }
 }
Exemplo n.º 5
0
</td>
    <td><?php 
echo $user->getName() . ' &lt;' . $user->getEmail() . '&gt;';
?>
</td>
  </tr>
  <tr>
    <td><?php 
echo __('To');
?>
<br><a href="#" onClick="return checkAllInContainer('users_groups_container')"><small><?php 
echo __('Select All');
?>
</small></a></td>
    <td><div id="users_groups_container"><?php 
echo select_tag('users_groups', '', array('choices' => UsersGroups::getChoicesByType(), 'multiple' => true, 'expanded' => true));
?>
</div></td>
  </tr>
  <tr>
    <td><?php 
echo __('Subject');
?>
</td>
    <td><?php 
echo input_tag('subject', $sf_request->getParameter('subject'), array('size' => 60, 'class' => 'required'));
?>
</td>
  </tr>
  <tr>
    <td><?php 
<?php

$user_id = Sentry::getUser()->id;
$user_group = UsersGroups::where('user_id', '=', $user_id)->get()->first();
$userDetails = UserDetails::where('user_id', '=', $user_id)->get()->first();
?>
@section('upper-dropdown')
<a data-toggle="dropdown" data-hover="dropdown" class="dropdown-toggle" data-close-others="true" href="#">
    @if($userDetails->pic == null)
    <img src="{{ URL::asset('assets/projects/images/no_img.png') }}" class="img-circle" alt="" width="30px" height="30px">
    @else
    <img src="{{ URL::asset('assets/projects/images/profilepics/'.$userDetails->pic) }}" class="img-circle" alt="" width="30px" height="30px">
    @endif
    <span class="username hidden-xs">{{ $userDetails->first_name }} {{ $userDetails->last_name }}</span> <i class="fa fa-caret-down "></i>
</a>
@stop
@section('left-user-profile')
<div class="inline-block">
    @if($userDetails->pic == null)
    <img src="{{ URL::asset('assets/projects/images/no_img.png') }}" class="img-circle" alt="" width="50px" height="50px">
    @else
    <img src="{{ URL::asset('assets/projects/images/profilepics/'.$userDetails->pic) }}" alt="" height="50px" width="50px">
    @endif
</div>
<div class="inline-block">
    <h5 class="no-margin"> Welcome </h5>
    <h4 class="no-margin"> {{ $userDetails->first_name }} {{ $userDetails->last_name }} </h4>
</div>
@stop

@section('left-menu')
 public function delete($user_id)
 {
     $tickets = Tickets::where('customer_id', $user_id)->get();
     //Delete tickets
     foreach ($tickets as $ticket) {
         TicketAttachments::where('thread_id', $ticket->id)->delete();
         MessageThread::where('id', $ticket->thread_id)->delete();
         ThreadMessages::where('thread_id', $ticket->thread_id)->delete();
     }
     Tickets::where('customer_id', $user_id)->delete();
     //Delete Chat and Conversations
     $online_users = OnlineUsers::where('user_id', $user_id)->get();
     foreach ($online_users as $online_user) {
         MessageThread::where('id', $online_user->thread_id)->delete();
         ThreadMessages::where('thread_id', $online_user->thread_id)->delete();
     }
     OnlineUsers::where('user_id', $user_id)->delete();
     $closed_conversations = ClosedConversations::where('user_id', $user_id)->get();
     foreach ($closed_conversations as $closed_conversation) {
         MessageThread::where('id', $closed_conversation->thread_id)->delete();
         ThreadMessages::where('thread_id', $closed_conversation->thread_id)->delete();
     }
     ClosedConversations::where('user_id', $user_id)->delete();
     UsersGroups::where('user_id', $user_id)->delete();
     CompanyCustomers::where("customer_id", $user_id)->delete();
     User::where("id", $user_id)->delete();
     RecentActivities::createActivity("Customer deleted by User ID:" . Auth::user()->id . " User Name:" . Auth::user()->name);
     Session::flash('success_msg', trans('msgs.customer_deleted_success'));
     return Redirect::to('/customers/all');
 }
Exemplo n.º 8
0
 public static function getAccessTable($ug, $type = '', $include_reports = true)
 {
     $html = '';
     switch ($type) {
         case 'projects':
             $html = '
         <table class="listingDataTable">
           <tr>
             <td><b>' . t::__('Projects') . ':</b></td>
             <td>' . UsersGroups::getAccessNameByKey($ug->getAllowManageProjects()) . '</td>
           </tr>              
           <tr>
             <td>' . t::__('Comments') . ':</td>
             <td>' . UsersGroups::getAccessNameByValue($ug->getAllowManageProjects()) . '</td>
           </tr>
           </table>
           <table class="listingDataTable">' . ($include_reports ? '<tr>
             <td>' . t::__('Projects Reports') . ':</td>
             <td>' . UsersGroups::getAccessNameByValue($ug->getAllowManageProjects()) . '</td>
           </tr>' : '') . '
          </table>';
             break;
         case 'tasks':
             $html = '
         <table class="listingDataTable">
           <tr>
             <td ><b>' . t::__('Tasks') . ':</b></td>
             <td>' . UsersGroups::getAccessNameByKey($ug->getAllowManageTasks()) . '</td>
           </tr>
           <tr>
             <td>' . t::__('Comments') . ':</td>
             <td>' . UsersGroups::getAccessNameByValue($ug->getAllowManageTasks()) . '</td>
           </tr>
           </table>' . ($include_reports ? '<table class="listingDataTable">
           <tr>
             <td>' . t::__('Tasks Reports') . ':</td>
             <td>' . UsersGroups::getAccessNameByValue($ug->getAllowManageTasks()) . '</td>
           </tr>
           <tr>
             <td>' . t::__('Gantt Chart') . ':</td>
             <td>' . UsersGroups::getAccessNameByValue($ug->getAllowManageTasks()) . '</td>
           </tr>
           <tr>
             <td>' . t::__('Time Report') . ':</td>
             <td>' . UsersGroups::getAccessNameByValue($ug->getAllowManageTasks()) . '</td>
           </tr>
           <tr>
             <td>' . t::__('Personal Time Report') . ':</td>
             <td>' . UsersGroups::getAccessNameByValue($ug->getAllowManageTasks()) . '</td>
           </tr> 
          </table>' : '');
             break;
         case 'tickets':
             $html = '
         <table class="listingDataTable">
           <tr>
             <td style="font-size: 11px;"><b>' . t::__('Tickets') . ':</b></td>
             <td>' . UsersGroups::getAccessNameByKey($ug->getAllowManageTickets()) . '</td>
           </tr>
           <tr>
             <td>' . t::__('Comments') . ':</td>
             <td>' . UsersGroups::getAccessNameByValue($ug->getAllowManageTickets()) . '</td>
           </tr>
           </table>' . ($include_reports ? '<table class="listingDataTable">
           <tr>
             <td>' . t::__('Tickets Reports') . ':</td>
             <td>' . UsersGroups::getAccessNameByValue($ug->getAllowManageTickets()) . '</td>
           </tr> 
          </table>' : '');
             break;
         case 'discussions':
             $html = '
         <table class="listingDataTable">
           <tr>
             <td><b>' . t::__('Discussions') . ':</b></td>
             <td>' . UsersGroups::getAccessNameByKey($ug->getAllowManageDiscussions()) . '</td>
           </tr>
           <tr>
             <td>' . t::__('Comments') . ':</td>
             <td>' . UsersGroups::getAccessNameByValue($ug->getAllowManageDiscussions()) . '</td>
           </tr>
           </table>' . ($include_reports ? '<table class="listingDataTable">
           <tr>
             <td>' . t::__('Discussions Reports') . ':</td>
             <td>' . UsersGroups::getAccessNameByValue($ug->getAllowManageDiscussions()) . '</td>
           </tr> 
          </table>' : '');
             break;
         case 'extra':
             $html = '
         <table class="listingDataTable">
           <tr>
             <td><b>' . t::__('Configuration') . ':</b></td>
             <td>' . UsersGroups::getAccessNameByValue($ug->getAllowManageConfiguration()) . '</td>
           </tr>
           <tr>
             <td>' . t::__('Users') . ':</td>
             <td>' . UsersGroups::getAccessNameByValue($ug->getAllowManageUsers()) . '</td>
           </tr>
          </table>';
             break;
     }
     $html = str_replace('<td>', '<td style="white-space:normal">', $html);
     return $html;
 }
Exemplo n.º 9
0
 public function getUser()
 {
     $this->__load();
     return parent::getUser();
 }
 public function delete($company_id)
 {
     $departments = Department::where('company_id', $company_id)->get();
     if (Config::get('site-config.is_demo') && $company_id == 1) {
         Session::flash('error_msg', 'Demo : Feature is disabled');
         return Redirect::to('/dashboard');
     }
     foreach ($departments as $department) {
         if (!empty($department)) {
             $tickets = Tickets::where('department_id', $department->id)->get();
             //Delete tickets
             foreach ($tickets as $ticket) {
                 TicketAttachments::where('thread_id', $ticket->id)->delete();
                 MessageThread::where('id', $ticket->thread_id)->delete();
                 ThreadMessages::where('thread_id', $ticket->thread_id)->delete();
             }
             Tickets::where('department_id', $department->id)->delete();
             //Delete Chat and Conversations
             $online_users = OnlineUsers::where('department_id', $department->id)->get();
             foreach ($online_users as $online_user) {
                 MessageThread::where('id', $online_user->thread_id)->delete();
                 ThreadMessages::where('thread_id', $online_user->thread_id)->delete();
             }
             OnlineUsers::where('department_id', $department->id)->delete();
             $closed_conversations = ClosedConversations::where('department_id', $department->id)->get();
             foreach ($closed_conversations as $closed_conversation) {
                 MessageThread::where('id', $closed_conversation->thread_id)->delete();
                 ThreadMessages::where('thread_id', $closed_conversation->thread_id)->delete();
             }
             ClosedConversations::where('department_id', $department->id)->delete();
             $operators = OperatorsDepartment::where('department_id', $department->id)->lists('user_id');
             if (sizeof($operators) > 0) {
                 User::whereIn('id', $operators)->delete();
                 UsersGroups::whereIn('user_id', $operators)->delete();
             }
             OperatorsDepartment::where('department_id', $department->id)->delete();
             $department_admin = DepartmentAdmins::where('department_id', $department->id)->first();
             if (!empty($department_admin)) {
                 UsersGroups::where('user_id', $department_admin->user_id)->delete();
                 User::where("id", $department_admin->user_id)->delete();
                 CompanyDepartmentAdmins::where("user_id", $department_admin->user_id)->delete();
                 CannedMessages::where('operator_id', $operators)->delete();
             }
         }
         DepartmentAdmins::where('department_id', $department->id)->delete();
         Department::where('id', $department->id)->delete();
     }
     $company = Company::where('id', $company_id)->first();
     RecentActivities::createActivity("Company <a href='/companies/all'>" . $company->name . "</a> deleted by User Name " . Auth::user()->name . " User ID " . Auth::user()->id);
     Company::where('id', $company_id)->delete();
     Session::flash('success_msg', trans('msgs.company_deleted_success'));
     return Redirect::to('/companies/all');
 }
 public function all()
 {
     $user_ids = [];
     if (\KodeInfo\Utilities\Utils::isDepartmentAdmin(Auth::user()->id)) {
         $department_admin = DepartmentAdmins::where('user_id', Auth::user()->id)->first();
         $department = Department::where('id', $department_admin->department_id)->first();
         $department_ids = Department::where('company_id', $department->company_id)->lists('id');
         $user_ids = DepartmentAdmins::whereIn('department_id', $department_ids)->lists('user_id');
     } elseif (\KodeInfo\Utilities\Utils::isOperator(Auth::user()->id)) {
         $department_admin = DepartmentAdmins::where('user_id', Auth::user()->id)->first();
         $department = Department::where('id', $department_admin->department_id)->first();
         $department_ids = Department::where('company_id', $department->company_id)->lists('id');
         $user_ids = DepartmentAdmins::whereIn('department_id', $department_ids)->lists('user_id');
     } else {
         $group = Groups::where("name", "department-admin")->first();
         $user_ids = UsersGroups::where("group_id", $group->id)->lists("user_id");
     }
     if (sizeof($user_ids) > 0) {
         $this->data["admins"] = User::whereIn("id", $user_ids)->orderBy('id', 'desc')->get();
     } else {
         $this->data["admins"] = [];
     }
     foreach ($this->data["admins"] as $admin) {
         $department_admin = DepartmentAdmins::where('user_id', $admin->id)->first();
         if (!empty($department_admin)) {
             $admin->department = Department::find($department_admin->department_id);
         }
         $company_id = CompanyDepartmentAdmins::where("user_id", $admin->id)->pluck('company_id');
         $admin->company = Company::find($company_id);
     }
     return View::make('department_admins.all', $this->data);
 }
Exemplo n.º 12
0
    ?>
</td>      
      <td><?php 
    echo UsersGroups::getAccessTable($users_groups, 'tasks');
    ?>
</td>
      <td><?php 
    echo UsersGroups::getAccessTable($users_groups, 'tickets');
    ?>
</td>
      <td><?php 
    echo UsersGroups::getAccessTable($users_groups, 'discussions');
    ?>
</td>      
      <td><?php 
    echo UsersGroups::getAccessTable($users_groups, 'extra');
    ?>
</td>
      
    </tr>
    <?php 
}
?>
    <?php 
if (sizeof($users_groupss) == 0) {
    echo '<tr><td colspan="7">' . __('No Records Found') . '</td></tr>';
}
?>
  </tbody>
</table>
<?php 
 public function all()
 {
     $group = Groups::where("name", "admin")->first();
     $user_ids = UsersGroups::where("group_id", $group->id)->lists("user_id");
     if (sizeof($user_ids) > 0) {
         $this->data["users"] = User::whereIn("id", $user_ids)->get();
     } else {
         $this->data["users"] = [];
     }
     return View::make('accounts.all', $this->data);
 }
 public function online()
 {
     if (\KodeInfo\Utilities\Utils::isDepartmentAdmin(Auth::user()->id)) {
         $department_admin = DepartmentAdmins::where('user_id', Auth::user()->id)->first();
         $department = Department::where('id', $department_admin->department_id)->first();
         $user_ids = OperatorsDepartment::where('department_id', $department->id)->lists('user_id');
     } else {
         $group = Groups::where("name", "operator")->first();
         $user_ids = UsersGroups::where("group_id", $group->id)->lists("user_id");
     }
     if (sizeof($user_ids) > 0) {
         $this->data["operators"] = User::whereIn("id", $user_ids)->where("is_online", 1)->get();
     } else {
         $this->data["operators"] = [];
     }
     foreach ($this->data["operators"] as $operator) {
         $department_id = OperatorsDepartment::where('user_id', $operator->id)->pluck("department_id");
         $department = Department::find($department_id);
         $company = Company::find($department->company_id);
         $operator->department = $department;
         $operator->company = $company;
     }
     $this->data['permissions'] = Permissions::all();
     $this->data['departments'] = Department::all();
     return View::make('operators.all', $this->data);
 }
Exemplo n.º 15
0
    <th><label for="cfg_app_use_ldap_login"><?php 
echo __('Use LDAP Login');
?>
</label></th>
    <td><?php 
echo select_tag('cfg[app_use_ldap_login]', sfConfig::get('app_use_ldap_login'), array('choices' => $default_selector));
?>
</td>
  </tr>
  <tr>
    <th><label for="cfg_app_ldap_default_user_group"><?php 
echo __('Default Group');
?>
</label></th>
    <td><?php 
echo select_tag('cfg[app_ldap_default_user_group]', sfConfig::get('app_ldap_default_user_group'), array('choices' => UsersGroups::getChoicesByType(false, true)));
?>
</td>
  </tr>
  <tr>
    <th><label for="cfg_app_ldap_host"><?php 
echo __('LDAP server name');
?>
</label></th>
    <td><?php 
echo input_tag('cfg[app_ldap_server]', sfConfig::get('app_ldap_server'), array('size' => 40)) . '<br><i>' . __('If using LDAP this is the hostname or IP address of the LDAP server. Alternatively you can specify a URL like ldap://hostname:port/') . '</i>';
?>
</td>
  </tr>
  <tr>
    <th><label for="cfg_app_ldap_port"><?php