/**
  * {@inheritdoc}
  */
 public function holdsFor(Context $context)
 {
     if (!$context->has($this->key)) {
         return false;
     }
     $argument = $context->get($this->key);
     return $this->operator->appliesTo($argument);
 }
Esempio n. 2
0
 /**
  * Restore original database.
  */
 public function __destruct()
 {
     if ($this->cloned) {
         // Drop and create source DB and copy temporary into it.
         $this->db->copy($this->temporary, $this->source);
         // Kill temporary DB.
         $this->db->drop($this->temporary);
     }
 }
Esempio n. 3
0
    function showMeetingUI()
    {
        $db = Database::getInstance();
        $cxn = $db->getConnection();
        $operator = new Operator();
        $operator->createOperatorList();
        if ($this->meetingid != '') {
            $q = "SELECT *,DATE_FORMAT(Meeting_Date,'%d-%m-%Y') as mdt,Participants FROM Meeting\n\tWHERE Meeting_ID={$this->meetingid}";
            if (!($res = $cxn->query($q))) {
                exit("error (showMeetingUI): {$cxn->error}");
            }
            $n = $res->num_rows;
            if ($n > 0) {
                $r = mysqli_fetch_assoc($res);
                $this->conductedby = $r['Conductedby'];
                $this->meetingdatedb = $r['Meeting_Date'];
                $this->participants = $r['Participants'];
                $this->meetingdatedb = $r['Meeting_Date'];
                $this->meetingdate = $r['mdt'];
                $this->agenda = $r['Agenda'];
                $this->participants = $r['Participants'];
                $qp = "SELECT * FROM Meeting_Points WHERE Meeting_ID={$this->meetingid}";
                if (!($resp = $cxn->query($qp))) {
                    exit("error (showMeetingUI2) {$qp}: {$cxn->error}");
                }
                $i = 0;
                while ($rr = mysqli_fetch_assoc($resp)) {
                    $this->pointsdiscussed[$i] = $rr['Point_Discussed'];
                    $this->meetingpointid[$i] = $rr['Meeting_Point_ID'];
                    $i++;
                }
            }
        }
        echo '<fieldset><legend>Meeting Details</legend>';
        $sel = new selectlist("Conductedby", $operator->getOperatorList(), 'Meeting Conducted By', 'Operator_ID', 'Operator_Name', 'class="required"', $this->conductedby, '1');
        echo '<p><label>Meeting Date</label><input id="meetingdate" name="meetingdate" class="required" value="' . $this->meetingdate . '"><input id="meetingdatedb" name="meetingdatedb" type="hidden" value="' . $this->meetingdatedb . '"></p>';
        echo '<p><label>Meeting Agenda</label><textarea id="agenda" name="agenda" cols="45" rows="5" class="required">' . $this->agenda . '</textarea></p>';
        echo '<p><label>Meeting Participants</label></p>';
        $operator->createOperatorGrid($this->participants);
        echo '</fieldset>';
        echo '<table id="points" width="100%" class="u"><tr><th align="center">Points Discussed</th><th>';
        echo '<th><input type="button" id="addpoint" value="Add Row"></th></tr>';
        if (isset($this->meetingpointid)) {
            $i = 0;
            $j = count($this->pointsdiscussed);
            while ($i < $j) {
                echo '<tr><td colspan="2"><textarea id="pointsdiscussed[' . $i . ']" name="pointsdiscussed[' . $i . ']"  rows="3" cols="40" class="required">' . $this->pointsdiscussed[$i] . '</textarea></td>
			<input type="hidden" id="meetingpointid[' . $i . ']" name="meetingpointid[' . $i . ']" value="' . $this->meetingpointid[$i] . '"></tr>';
                $i++;
            }
        } else {
            echo '<tr><td colspan="2"><textarea id="pointsdiscussed[0]" name="pointsdiscussed[0]"  rows="3" cols="40" class="required"></textarea></td></tr>';
        }
        echo '</table>';
    }
Esempio n. 4
0
 public function compare(Operator $op)
 {
     if ($this->priority < $op->getPriority()) {
         return -1;
     } else {
         if ($this->priority > $op->getPriority()) {
             return 1;
         } else {
             return 0;
         }
     }
 }
Esempio n. 5
0
 function CreateOperator($_loginId, $_fullName, $_email, $_permissions, $_webspace, $_passwordMD5, $_administrator, $_groups, $_language)
 {
     $operator = new Operator(getId(USER_ID_LENGTH), $_loginId);
     $operator->Load();
     $operator->Fullname = $_fullName;
     $operator->Email = $_email;
     $operator->PermissionSet = $_permissions;
     $operator->Webspace = $_webspace;
     $operator->Password = $_passwordMD5;
     $operator->Level = $_administrator ? 1 : 0;
     $operator->Groups = $_groups;
     $operator->Language = $_language;
     $operator->Save(true);
     return $operator;
 }
Esempio n. 6
0
 public static function getInstance()
 {
     if (self::$instance == null) {
         self::$instance = new self();
     }
     return self::$instance;
 }
Esempio n. 7
0
 public function loginAction()
 {
     if ($this->isLogin()) {
         $this->redirect(\Func\url('/', true));
     }
     if ($this->isAjax()) {
         $data = $this->request->getPost();
         if (empty($data)) {
             $this->pageError('param');
         }
         $modelForm = new OperatorForm('login');
         if ($result = $modelForm->validate($data)) {
             if ($info = $modelForm->login()) {
                 if ($info->status == Operator::STATUS_FREEZE) {
                     $this->error('该账号已冻结');
                 }
                 $_sess = ['oid' => $info->oid, 'username' => $info->username, 'rid' => $info->rid, 'rname' => Role::getNameById($info->rid), 'bname' => Branch::getNameById($info->bid), 'bid' => $info->bid, 'auth' => Operator::getAuthByRid($info->rid), 'expire' => time() + $this->getConfig('session', 'expire')];
                 $this->session->set('operator', $_sess);
                 $this->success(['msg' => '登录成功', 'redirect' => ['url' => \Func\url('/'), 'seconds' => 0]]);
             } else {
                 $this->error('账号或密码错误');
             }
         }
         $error = $modelForm->getErrors();
         if ($error) {
             $this->error($error);
         }
         $this->error('参数错误');
     }
     $this->single('login');
 }
 static function getInstance()
 {
     if (self::$instance == NULL) {
         self::$instance = new Operator();
     }
     return self::$instance;
 }
Esempio n. 9
0
 public function render()
 {
     $operands = array();
     foreach ($this->_operands as $opr) {
         if ($opr instanceof Expression) {
             $opr_rendered = $opr->render();
             $num_oprs = $opr->getNumOperands();
             if ($num_oprs > 1) {
                 $opr_rendered = '(' . $opr_rendered . ')';
             }
             $opr = $opr_rendered;
         }
         $operands[] = $opr;
     }
     $operator = Operator::toHtml($this->_operator);
     if (false !== ($decorator = $this->getDecorator('operator'))) {
         $operator = $decorator->decorate($operator);
     }
     switch (sizeof($operands)) {
         case 1:
             $format = '%s %s';
             $params = array($operator, $operands[0]);
             break;
         case 2:
             $format = '%s %s %s';
             $params = array($operands[0], $operator, $operands[1]);
             break;
     }
     $expression = vsprintf($format, $params);
     if (false !== ($decorator = $this->getDecorator('expression'))) {
         $expression = $decorator->decorate($expression);
     }
     return $expression;
 }
Esempio n. 10
0
 public static function currentOperatorHasAnyOfPermissions($requested_permissions_arr)
 {
     $current_user_has_any_of_permissions = Auth::currentUserHasAnyOfPermissions($requested_permissions_arr);
     if ($current_user_has_any_of_permissions) {
         return true;
     }
     $current_user_id = Auth::currentUserId();
     if (!$current_user_id) {
         //error_log('Auth: no current user');
         return false;
     }
     // check operator permissions
     $current_operator_ids_arr = Operator::getIdsArrForUserIdByCreatedAtDesc($current_user_id);
     if (empty($current_operator_ids_arr)) {
         //error_log('Auth: no operators for user ' . $current_user_id);
         return false;
     }
     $current_operator_id = $current_operator_ids_arr[0];
     $operator_permissions_ids_arr = OperatorPermission::getIdsArrForOperatorIdByCreatedAtDesc($current_operator_id);
     $assigned_permissions_titles_arr = [];
     foreach ($operator_permissions_ids_arr as $operator_permission_id) {
         $operator_permission_obj = OperatorPermission::factory($operator_permission_id);
         $permission_id = $operator_permission_obj->getPermissionId();
         $permission_obj = Permission::factory($permission_id);
         $assigned_permissions_titles_arr[] = $permission_obj->getTitle();
         if (in_array($permission_obj->getTitle(), $requested_permissions_arr)) {
             return true;
         }
     }
     //error_log('Auth: no permissions for operator ' . $current_operator_id . ' (' . implode(',', $operator_permissions_ids_arr) . ') (' . implode(',', $assigned_permissions_titles_arr) . ') matched requested list: ' . implode(',', $requested_permissions_arr));
     return false;
 }
Esempio n. 11
0
 public function execute()
 {
     global $gvPath;
     $code = $_POST['code'];
     $password = $_POST['password'];
     session_destroy();
     unset($_SESSION);
     session_start();
     if ($this->isValidSysAdminLogin($code, $password)) {
         global $gvEditableConfs;
         $_SESSION['userLevel'] = Page::SYSADMIN_USER;
         if ($code == $gvEditableConfs[0]->getDefault() && $password == $gvEditableConfs[1]->getDefault()) {
             // Access with default credentials. Redirect to settings.
             $redirect = new RedirectOutput($gvPath . "/application/adminSettings");
         } else {
             $redirect = new RedirectOutput($gvPath . "/application/adminPage");
         }
         return $redirect;
     }
     if (Operator::isValidLogin($code, $password)) {
         Operator::clearTableForLogout($code);
         try {
             Session::loginOperator($code);
         } catch (UnknownDeskException $e) {
             global $gvPath;
             $errorPage = new ErrorPageOutput("Sportello non riconosciuto", "Il presente computer non è stato registrato come sportello.<br />" . "Indirizzo IP da registrare: " . $_SERVER['REMOTE_ADDR'], "<a href=\"{$gvPath}/application/loginPage\">Torna indietro</a>");
             return $errorPage;
         }
         $redirect = new RedirectOutput($gvPath . "/application/opPage");
         return $redirect;
     }
     // Login failed
     $this->errorMessage = "Codice o password non validi!";
     return true;
 }
 function GroupBuilder($_internalUsers, $_internalGroups, $_config, $_reqGroup = "", $_reqOperator = "", $allowCom = true)
 {
     $this->ReqGroup = !empty($_GET[GET_EXTERN_GROUP]) ? base64UrlDecode($_GET[GET_EXTERN_GROUP]) : $_reqGroup;
     $this->ReqOperator = !empty($_GET[GET_EXTERN_INTERN_USER_ID]) ? base64UrlDecode($_GET[GET_EXTERN_INTERN_USER_ID]) : $_reqOperator;
     $this->InternalUsers = $_internalUsers;
     $this->InternalGroups = $_internalGroups;
     $this->Config = $_config;
     $this->GroupValues["groups_online"] = array();
     $this->GroupValues["groups_offline"] = array();
     $this->GroupValues["groups_online_amounts"] = array();
     $this->GroupValues["groups_output"] = array();
     $this->GroupValues["groups_hidden"] = array();
     $this->GroupValues["set_by_get_user"] = null;
     $this->GroupValues["set_by_get_group"] = null;
     $this->GroupValues["set_by_cookie"] = null;
     $this->GroupValues["set_by_standard"] = null;
     $this->GroupValues["set_by_online"] = null;
     $this->GroupValues["req_for_user"] = !empty($this->ReqOperator);
     $this->GroupValues["req_for_group"] = !empty($this->ReqGroup);
     $this->Parameters = getTargetParameters($allowCom);
     if ($this->Parameters["include_group"] != null || $this->Parameters["include_user"] != null) {
         foreach ($_internalGroups as $gid => $group) {
             if (!($this->Parameters["include_group"] != null && in_array($gid, $this->Parameters["include_group"]))) {
                 if (!($this->Parameters["include_user"] != null && in_array($gid, $_internalUsers[Operator::GetSystemId($this->Parameters["include_user"])]->GetGroupList(false)))) {
                     $this->GroupValues["groups_hidden"][] = $gid;
                 }
             }
         }
     }
     if ($this->Parameters["exclude"] != null) {
         $this->GroupValues["groups_hidden"] = $this->Parameters["exclude"];
     }
 }
Esempio n. 13
0
function processActions()
{
    global $BROWSER, $CONFIG;
    $actionData = "";
    $BROWSER->GetActions();
    if ($BROWSER->Request != null && $BROWSER->Request->Status == REQUEST_STATUS_ACTIVE) {
        $requestUser = new Operator($BROWSER->Request->SenderSessId, $BROWSER->Request->SenderUserId);
        $requestUser->Load();
        if ($requestUser->LastActive < time() - $CONFIG["timeout_clients"] || $requestUser->Status == USER_STATUS_OFFLINE) {
            $BROWSER->Request->Destroy();
            $actionData .= "lz_tracking_close_request();";
        }
        if (isset($_GET[GET_TRACK_REQUEST_DECLINED]) || isset($_GET[GET_TRACK_REQUEST_ACCEPTED])) {
            if (isset($_GET[GET_TRACK_REQUEST_DECLINED])) {
                $BROWSER->Request->Decline();
            }
            if (isset($_GET[GET_TRACK_REQUEST_ACCEPTED])) {
                $BROWSER->Request->Accept();
            }
            $actionData .= "lz_tracking_close_request();";
        }
    } else {
        if ($BROWSER->Request != null && $BROWSER->Request->Status != REQUEST_STATUS_ACTIVE) {
            $actionData .= "lz_tracking_close_request();";
        }
    }
    if ($BROWSER->Request != null && $BROWSER->Request->Status == REQUEST_STATUS_ACTIVE && !isset($_GET[GET_TRACK_REQUEST_ACTIVE])) {
        $height = !@file_exists(FILE_INVITATIONLOGO) ? 220 : 302;
        $actionData .= $BROWSER->Request->GetCommand(getInvitationTemplate($BROWSER->Request->Id, $BROWSER->Request->SenderUserId, $BROWSER->UserId, $BROWSER->Request->SenderFullname, $BROWSER->Request->SenderGroupId), htmlentities($BROWSER->Request->Text, ENT_QUOTES, "UTF-8"), 302, $height);
    } else {
        if ($BROWSER->Request != null && $BROWSER->Request->Status == REQUEST_STATUS_ACCEPTED) {
            // hold
        }
    }
    if ($BROWSER->Guide != null) {
        $actionData .= $BROWSER->Guide->GetCommand();
        $BROWSER->Guide->Destroy();
    }
    if ($BROWSER->Alerts != null) {
        foreach ($BROWSER->Alerts as $alert) {
            $actionData .= $alert->GetCommand();
            $alert->Destroy();
        }
        $actionData = str_replace("<!--server-->", LIVEZILLA_URL, $actionData);
    }
    return $actionData;
}
Esempio n. 14
0
 public function loadModel($id)
 {
     $model = Operator::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }
Esempio n. 15
0
 public static function logoutOperator()
 {
     $_SESSION['userLevel'] = Page::NORMAL_USER;
     Operator::clearTableForLogout($_SESSION['op_code']);
     unset($_SESSION['op_code']);
     unset($_SESSION['desk_number']);
     unset($_SESSION['td_served']);
 }
Esempio n. 16
0
 function build_edit_emergency_popup($id)
 {
     $db_functions_obj = new DbFunctions();
     $helper_obj = new Helper();
     $emergency_info = $db_functions_obj->get_emergency_by_id($id);
     global $base_path;
     $operator = new Operator();
     $output = "<div class='popup-header'>" . $helper_obj->t("Edit Emergency Call") . "</div>";
     $output .= "<form class='form-horizontal form-validate form-vertical form-bordered' name='edit_emergency' id='edit_emergency' method='post' action='{$base_path}" . "edit_emergency'>";
     $output .= "<div class='control-group'>\n                        <label class='control-label' for='textarea'>name</label>\n                        <div class='controls'>\n                            <input id='textfield' class='input-xlarge' type='text' data-rule-required='true' value='{$emergency_info->name}' placeholder='{$emergency_info->name}' name='name'>\n                        </div>\n                    </div>";
     $output .= "<div class='control-group'>\n                        <label class='control-label' for='numberfield'>phone</label>\n                        <div class='controls'>\n                            <input id='numberfield' class='input-xlarge' type='text' data-rule-number='true' data-rule-required='true' value='{$emergency_info->phone}' placeholder='{$emergency_info->phone}' name='phone'>\n                        </div>\n                    </div>";
     $output .= $operator->build_country_list('emergency', $emergency_info->country_id);
     $output .= "<input type='hidden' name='emergency_id' value='" . $emergency_info->id . "'>";
     $output .= "<input class='btn btn-primary' type='submit' value='" . $helper_obj->t("Save") . "'>";
     $output .= "</form>";
     $output .= "<script>\n                    \$(document).ready(function() {        \n                       \$(\"#emergency_textfield\").datepicker();   \n                     \n                       \$('#edit_emergency').ajaxForm(function(res) { \n                           var isvalid = \$(\"#edit_emergency\").valid();\n                           if (isvalid) { \n                               var data = res.split(\"***#***\");   \n                               \$('#emergency_' + data[1]).after(data[0]);\n                               \$('#emergency_' + data[1]).remove(); \n                               closePopup();\n                           }  \n                       }); \n                    });\n                    </script>";
     return $output;
 }
Esempio n. 17
0
 public function __construct($limit, $skip = 0)
 {
     if ($skip == 0) {
         $value = $limit;
     } else {
         $value = [$skip, $limit];
     }
     parent::__construct('$slice', $value);
 }
Esempio n. 18
0
 /**
  */
 public function perms()
 {
     $perms = array('accountcodes' => array('title' => _("Account Codes")));
     $accountcodes = Operator::getAccountCodes();
     foreach ($accountcodes as $accountcode) {
         $perms['accountcodes:' . $accountcode] = array('title' => $accountcode);
     }
     return $perms;
 }
Esempio n. 19
0
 public function __construct($title, &$vars)
 {
     parent::__construct($title, $vars);
     $graphtypes = Operator::getGraphInfo();
     $graphs = array();
     foreach ($graphtypes as $type => $info) {
         $graphs[$type] = $info['title'];
     }
     $this->addVariable(_("Graph"), 'graph', 'enum', true, false, null, array($graphs));
 }
Esempio n. 20
0
 public static function edit($oid, $data)
 {
     /*
     		if (self::is_super($oid))
     			return false;
     */
     $info = Operator::findFirst($oid);
     foreach ($data as $field => $value) {
         $info->{$field} = $value;
     }
     return $info->update();
 }
Esempio n. 21
0
 public function changeStatus($status)
 {
     $oid = intval($this->urlParam());
     empty($oid) and $this->error('参数错误');
     $info = Operator::findFirst($oid);
     empty($info) and $this->error('该账号不存在');
     $info->status = $status;
     if ($info->update()) {
         $this->success('操作成功');
     } else {
         $this->error('操作失败');
     }
 }
Esempio n. 22
0
function operatorSubmitted()
{
    $operator = Operator::getInstance()->GetLoggedOperator();
    $TML = new SmartyClass();
    setOperator($TML);
    $TML->assign('mode', 'profile');
    $toCheck = array('login' => 'form.field.login', 'fullname' => 'form.field.agent_name', 'email' => 'form.field.agent_email');
    foreach ($toCheck as $field => $res) {
        if (empty($_REQUEST[$field])) {
            $errors[] = Resources::Get("errors.required", array(Resources::Get($res)));
        }
    }
    if (empty($errors) && !preg_match("/^[\\w_]+\$/", $_REQUEST['login'])) {
        $errors[] = Resources::Get("page_agent.error.wrong_login");
    }
    if ($_REQUEST['password'] != $_REQUEST['password_confirm']) {
        $errors[] = Resources::Get('my_settings.error.password_match');
    }
    if (!empty($_REQUEST['password']) && md5($_REQUEST['password_existing']) != $operator['password']) {
        $errors[] = Resources::Get('my_settings.error.password_existing');
    }
    $hash = array();
    $requestFile = $_FILES['avatarFile'];
    if (empty($errors) && isset($requestFile) && !empty($requestFile['name']) && $requestFile['size'] > 0 && $requestFile['error'] == 0) {
        $res = Operator::getInstance()->UploadOperatorAvatar($operator['operatorid'], $requestFile);
        if (isset($res)) {
            $errors[] = $res;
        }
        if (empty($errors)) {
            $hash['avatar'] = Operator::getInstance()->getAvatarURL($operator['operatorid'], $requestFile['name']);
        }
    }
    if (empty($errors)) {
        $hash['login'] = $_REQUEST['login'];
        $hash['email'] = $_REQUEST['email'];
        $hash['fullname'] = $_REQUEST['fullname'];
        if (!empty($_REQUEST['password'])) {
            $hash['password'] = md5($_REQUEST['password']);
        }
        Operator::getInstance()->UpdateOperator($operator['operatorid'], $hash);
        Operator::getInstance()->RefreshSessionOperator();
        header("Location: " . WEBIM_ROOT . "/operator/profile.php");
        exit;
    }
    foreach (array('login', 'email', 'fullname') as $f) {
        $TML->assign($f, $_REQUEST[$f]);
    }
    $TML->assign('errors', $errors);
    $TML->display('../templates/operator.tpl');
    exit;
}
Esempio n. 23
0
 /**
  * @return array[]
  */
 public function parseProvider()
 {
     //prepare provider values for all operators
     $provider = [];
     foreach (Operator::getNullableOperators() as $operator) {
         $provider[] = [$operator, [$operator, null]];
     }
     $operators = array_merge(Operator::getEqualityOperators(), Operator::getOrderableOperators(), Operator::getLikeOperators());
     foreach ($operators as $operator) {
         $value = (string) rand(0, 100);
         $provider[] = [sprintf('%s%s', $operator, $value), [$operator, $value]];
     }
     return $provider;
 }
Esempio n. 24
0
 private function removeOperator()
 {
     $op_id = $_GET['op_id'];
     $operator = Operator::fromDatabaseById($op_id);
     if ($operator) {
         if ($operator->isOnline()) {
             return 'operatorOnline';
         }
         if ($operator->delete()) {
             return 'true';
         }
     }
     return 'false';
 }
Esempio n. 25
0
 /**
  * @param Node|array $data
  * @return static
  */
 public function set($data)
 {
     if (!$this->fullNode($data)) {
         $items = [];
         foreach ($data as $n => $i) {
             if ($this->fullNode($i)) {
                 $items[] = Operator::bin(Identifier::node($n), '=', $i);
             } else {
                 $items[] = Operator::bin(Identifier::node($n), '=', Value::node($i));
             }
         }
         $data = Enum::expr($items);
     }
     $this->data = $data;
     return $this;
 }
Esempio n. 26
0
 /**
  * 给角色分配权限
  */
 public function allotAction()
 {
     if ($this->isAjax()) {
         $data = $this->request->getPost();
         $data['auth'] = serialize(self::toArray($data['auth']));
         switch ($data['type']) {
             case 'role':
                 $modelForm = new RoleForm('auth');
                 $data['rid'] = $data['id'];
                 unset($data['id']);
                 break;
             case 'operator':
                 $data['oid'] = $data['id'];
                 unset($data['id']);
                 $modelForm = new OperatorForm('auth');
                 break;
             default:
                 $this->error('参数错误');
                 break;
         }
         if ($result = $modelForm->validate($data)) {
             if ($modelForm->allot()) {
                 $this->success('操作成功');
             } else {
                 $this->success('操作失败');
             }
         }
         $this->error('操作失败');
     }
     $params = $this->dispatcher->getParams();
     $type = $params[0];
     $id = $params[1];
     if (empty($type) || empty($id)) {
         $this->pageError('param');
     }
     switch ($type) {
         case 'role':
             $info = Role::findById($id);
             $modelForm = new RoleForm('auth', $info);
             break;
         case 'operator':
             $info = Operator::findById($id);
             $modelForm = new OperatorForm('auth', $info);
             break;
     }
     $this->view->setVars(['info' => $info, 'form' => $modelForm, 'authorities' => self::allAuthorities(), 'formparams' => ['action' => \Func\url('/authority/allot/role/'), 'type' => $type, 'id' => $id]]);
 }
Esempio n. 27
0
function _operator_perms()
{
    static $perms = array();
    if (!empty($perms)) {
        return $perms;
    }
    @define('OPERATOR_BASE', __DIR__ . '/..');
    require_once OPERATOR_BASE . '/lib/base.php';
    $perms['tree']['operator']['accountcodes'] = false;
    $perms['title']['operator:accountcodes'] = _("Account Codes");
    $accountcodes = Operator::getAccountCodes();
    foreach ($accountcodes as $accountcode) {
        $perms['tree']['operator']['accountcodes'][$accountcode] = false;
        $perms['title']['operator:accountcodes:' . $accountcode] = $accountcode;
    }
    return $perms;
}
Esempio n. 28
0
 public static function template_new_ggi_mail($param, $is_resend = false)
 {
     $param = json_decode(json_encode($param), FALSE);
     $user_name = str_replace('@gameloft.com', '', $_SERVER['REMOTE_USER']);
     $user_name = str_replace('.', ' ', ucfirst($user_name));
     $to[] = $_SERVER['REMOTE_USER'];
     if (ENVIRONMENT == GOLD || ENVIRONMENT == STAGING) {
         $cc[] = MAIL_WOA;
         $bcc[] = '*****@*****.**';
     }
     $platform = Platform::load($param->platform_id)->to_array();
     $operator = Operator::load($param->operator_id)->to_array();
     $country = Country::load($param->country_id)->to_array();
     $product = Product::load($param->product_id)->to_array();
     $store = Appstores::load($param->store_id)->to_array();
     $template_params = array();
     $template_params['user_name'] = $user_name;
     $template_params['platform_name'] = $platform['name'];
     $template_params['operator_name'] = $operator['name'];
     $template_params['country_name'] = $country['name'];
     $template_params['product_name'] = $product['name'];
     $template_params['product_id'] = $param->product_id;
     $template_params['ggi'] = $param->ggi;
     $template_params['store_name'] = $store['name'];
     $template_params['deployment_silo'] = $param->deployment_silo;
     $tpl = (object) $template_params;
     //Get email template
     ob_start();
     $subject = 'TUNA - Request of new project (GGI): ' . $param->ggi;
     include_once 'mail_templates/new_project.php';
     $body = ob_get_contents();
     ob_end_clean();
     //Send the email
     $m = new Mail('text/html');
     $m->to(@implode(',', $to));
     $m->cc(@implode(',', $cc));
     $m->bcc(@implode(',', $bcc));
     $m->subject($subject);
     $m->body($body);
     $m->send();
     TunaLog::info_log(__CLASS__, __FUNCTION__, $_SERVER['REMOTE_USER'], '');
 }
Esempio n. 29
0
    private function getTableBody()
    {
        global $gvPath;
        $operators = Operator::fromDatabaseCompleteList();
        if (count($operators) === 0) {
            return '<tr><td colspan="3" class="noEntry">Nessun operatore</td></tr>';
        }
        $ret = "";
        foreach ($operators as $operator) {
            $ret .= <<<EOS
<tr>
        <td>{$operator->getCode()}</td>
        <td>{$operator->getFullName()}</td>
\t<td><a href="{$gvPath}/application/adminOperatorEdit?op_id={$operator->getId()}">Modifica</a>&nbsp;&nbsp;
        <a class="ajaxRemove" href="{$gvPath}/ajax/removeRecord?op_id={$operator->getId()}">Rimuovi</a></td>
</tr>
EOS;
        }
        return $ret;
    }
Esempio n. 30
0
 public static function getImageNameFromParam($pImage, $pDepartmentKey = null, $pLang = null, $pImagePostfix = null, $hasOnline = null)
 {
     if (!preg_match('/\\.(gif|jpg|png)$/i', $pImage)) {
         $image = $pImage . '.gif';
     } else {
         $image = $pImage;
     }
     if (empty($pLang) || !Resources::IsLocaleAvailable($pLang)) {
         $lang = Resources::getCurrentLocale();
     } else {
         $lang = $pLang;
     }
     if (empty($pImagePostfix)) {
         if (empty($hasOnline)) {
             $image_postfix = Operator::getInstance()->hasOnlineOperators($pDepartmentKey, $lang) ? 'on' : 'off';
         } else {
             $image_postfix = $hasOnline ? 'on' : 'off';
         }
     } else {
         $image_postfix = $pImagePostfix;
     }
     $image = preg_replace('/\\.(gif|jpg|png)/i', '_' . $image_postfix . '.\\1', $image);
     return "/themes/.buttons/{$lang}/{$image}";
 }