function showOptions($sql) { $service = new BaseService(); $results = $service->GetRows($sql); $id = 0; $i = 0; foreach ($results as $row) { if ($i == 0) { $id = $row[0]; } echo "<option value='" . $row[0] . "'>" . $row[1] . "</option>"; $i++; } return $id; }
/** * Update a specific email campaign * @param string $accessToken - Constant Contact OAuth2 access token * @param Campaign $campaign - Campaign to be updated * @return Campaign */ public function updateCampaign($accessToken, Campaign $campaign) { $baseUrl = Configs::get('endpoints.base_url') . sprintf(Configs::get('endpoints.campaign'), $campaign->id); $url = $this->buildUrl($baseUrl); $response = parent::getRestClient()->put($url, parent::getHeaders($accessToken), $campaign->toJson()); return Campaign::create(json_decode($response->body, true)); }
public static function getInstance() { if (empty(self::$me)) { self::$me = new BaseService(); } return self::$me; }
public function __construct() { parent::__construct(); $this->load->model('catalog/product'); $this->load->model('tool/image'); $this->language->load('product/product'); }
function init(&$server) { parent::init($server); $server->wsdl->addComplexType('Version', 'complexType', 'struct', 'all', '', array('shopver' => array('name' => 'shopver', 'type' => 'xsd:string'), 'assisver' => array('name' => 'assisver', 'type' => 'xsd:string'))); $server->register('GetVersion', array(), array('return' => 'tns:Version'), 'urn:shopexapi', 'urn:shopexapi#GetVersion', 'rpc', 'encoded', ''); $server->register('Login', array('user' => 'xsd:string', 'pass' => 'xsd:string', 'loginas' => 'xsd:int'), array('return' => 'xsd:boolean'), 'urn:shopexapi', 'urn:shopexapi#Login', 'rpc', 'encoded', ''); $server->register('GetRedirectToken', array('user' => 'xsd:string', 'pass' => 'xsd:string', 'loginas' => 'xsd:int'), array('return' => 'xsd:string'), 'urn:shopexapi', 'urn:shopexapi#GetRedirectToken', 'rpc', 'encoded', ''); }
function init(&$server) { parent::init($server); $server->register('GetFileSize', array('baseType' => 'xsd:int', 'filename' => 'xsd:string'), array('return' => 'xsd:int'), 'urn:shopexapi', 'urn:shopexapi#GetFileSize', 'rpc', 'encoded', ''); $server->register('DownloadFile', array('baseType' => 'xsd:int', 'filename' => 'xsd:string'), array(), 'urn:shopexapi', 'urn:shopexapi#DownloadFile', 'rpc', 'encoded', ''); $server->register('UploadFile', array('baseType' => 'xsd:int', 'filename' => 'xsd:string', 'append' => 'xsd:boolean'), array(), 'urn:shopexapi', 'urn:shopexapi#UploadFile', 'rpc', 'encoded', ''); $server->register('UploadGoodsImage', array('goods_id' => 'xsd:int', 'gimage_ids' => 'tns:IntegerArray'), array(), 'urn:shopexapi', 'urn:shopexapi#UploadGoodsImage', 'rpc', 'encoded', ''); }
private function getEmployeeData($id, $obj) { $data = array(); $objs = $obj->Find("employee = ?", array($id)); foreach ($objs as $entry) { $data[] = BaseService::getInstance()->cleanUpAdoDB($entry); } return $data; }
public function __construct() { parent::__construct(); // Ezmlm lib $this->lib = new Ezmlm(); // additional settings $this->defaultMessagesLimit = $this->config['settings']['defaultMessagesLimit']; $this->defaultThreadsLimit = $this->config['settings']['defaultThreadsLimit']; }
function includeModuleManager($type,$name){ $moduleCapsName = ucfirst($name); $moduleTypeCapsName = ucfirst($type); // Admin or Modules $incFile = CLIENT_PATH.'/'.$type.'/'.$name.'/api/'.$moduleCapsName.$moduleTypeCapsName."Manager.php"; include ($incFile); $moduleManagerClass = $moduleCapsName.$moduleTypeCapsName."Manager"; BaseService::getInstance()->addModuleManager(new $moduleManagerClass()); }
public function addNotification($toEmployee, $message, $action, $type, $toUserId = null, $fromSystem = false, $sendEmail = false) { $userEmp = new User(); if (!empty($toEmployee)) { $userEmp->load("employee = ?", array($toEmployee)); if (!empty($userEmp->employee) && $userEmp->employee == $toEmployee) { $toUser = $userEmp->id; } else { return; } } else { if (!empty($toUserId)) { $toUser = $toUserId; } } $noti = new Notification(); if ($fromSystem) { $noti->fromUser = 0; $noti->fromEmployee = 0; $noti->image = BASE_URL . "images/icehrm.png"; } else { $user = $this->baseService->getCurrentUser(); $noti->fromUser = $user->id; $noti->fromEmployee = $user->employee; } $noti->toUser = $toUser; $noti->message = $message; if (!empty($noti->fromEmployee) && $noti->fromEmployee != 0) { $employee = $this->baseService->getElement('Employee', $noti->fromEmployee, null, true); if (!empty($employee)) { $employee = FileService::getInstance()->updateProfileImage($employee); $noti->image = $employee->image; } } if (empty($noti->image)) { if ($employee->gender == 'Male') { $noti->image = BASE_URL . "images/user_male.png"; } else { $noti->image = BASE_URL . "images/user_female.png"; } } $noti->action = $action; $noti->type = $type; $noti->time = date('Y-m-d H:i:s'); $noti->status = 'Unread'; $ok = $noti->Save(); if (!$ok) { error_log("Error adding notification: " . $noti->ErrorMsg()); } else { if ($sendEmail) { $emailSender = BaseService::getInstance()->getEmailSender(); if (!empty($emailSender)) { $emailSender->sendEmailFromNotification($noti); } } } }
protected function setUp() { parent::setUp(); include APP_BASE_PATH . "admin/users/api/UsersEmailSender.php"; include APP_BASE_PATH . "admin/users/api/UsersActionManager.php"; $this->obj = new UsersActionManager(); $this->obj->setUser($this->usersArray['admin']); $this->obj->setBaseService(BaseService::getInstance()); $this->obj->setEmailSender(BaseService::getInstance()->getEmailSender()); }
/** * 生成永久二唯码 * @param int|string $sceneId 场景值ID 32位非0整型,最大值为100000,目前参数只支持1--100000; 字符串形式的ID,长度限制为1到64,仅永久二维码支持 * @return array 返回值参考 QrcodeService::temporary()方法的返回值 */ public static function forever($sceneId) { $url = 'https://api.weixin.qq.com/cgi-bin/qrcode/create?access_token=ACCESS_TOKEN'; if (is_numeric($sceneId) && $sceneId >= 1 && $sceneId < 100000) { $data = array('action_name' => 'QR_LIMIT_SCENE', 'action_info' => array('scene' => array('scene_id' => $sceneId))); } else { $data = array('action_name' => 'QR_LIMIT_STR_SCENE', 'action_info' => array('scene' => array('scene_str' => $sceneId))); } return parent::request($url, $data); }
function init(&$server) { parent::init($server); $server->wsdl->addComplexType('ConditionItem', 'complexType', 'struct', 'all', '', array('fieldname' => array('name' => 'fieldname', 'type' => 'xsd:string'), 'comparesign' => array('name' => 'comparesign', 'type' => 'xsd:string'), 'fieldvalue' => array('name' => 'fieldvalue', 'type' => 'xsd:string'), 'joinflag' => array('name' => 'join', 'type' => 'xsd:string'), 'groupfalg' => array('name' => 'group', 'type' => 'xsd:string'))); $server->wsdl->addComplexType('ConditionItemArray', 'complexType', 'array', '', 'SOAP-ENC:Array', array(), array(array('ref' => 'SOAP-ENC:arrayType', 'wsdl:arrayType' => 'tns:ConditionItem[]')), 'tns:ConditionItem'); $server->wsdl->addComplexType('OrderByItem', 'complexType', 'struct', 'all', '', array('fieldname' => array('name' => 'fieldname', 'type' => 'xsd:string'), 'orderby' => array('name' => 'orderby', 'type' => 'xsd:string'))); $server->wsdl->addComplexType('OrderByItemArray', 'complexType', 'array', '', 'SOAP-ENC:Array', array(), array(array('ref' => 'SOAP-ENC:arrayType', 'wsdl:arrayType' => 'tns:OrderByItem[]')), 'tns:OrderByItem'); $server->register('GetRecordCount', array('table' => 'xsd:string', 'cndarr' => 'tns:ConditionItemArray'), array('return' => 'xsd:int'), 'urn:shopexapi', 'urn:shopexapi#GetRecordCount', 'rpc', 'encoded', ''); $server->register('DownloadRecord', array('table' => 'xsd:string', 'fields' => 'tns:StringArray', 'cndarr' => 'tns:ConditionItemArray', 'orders' => 'tns:OrderByItemArray', 'limit' => 'xsd:boolean', 'offset' => 'xsd:int', 'rowcount' => 'xsd:int', 'delimiter' => 'xsd:string', 'enclosure' => 'xsd:string'), array('return' => 'xsd:int'), 'urn:shopexapi', 'urn:shopexapi#DownloadRecord', 'rpc', 'encoded', ''); $server->register('UploadRecord', array('table' => 'xsd:string', 'fields' => 'tns:StringArray', 'guidfield' => 'xsd:string', 'idfield' => 'xsd:string', 'syncfield' => 'xsd:string', 'delimiter' => 'xsd:string', 'enclosure' => 'xsd:string'), array('return' => 'tns:SyncPack'), 'urn:shopexapi', 'urn:shopexapi#UploadRecord', 'rpc', 'encoded', ''); }
public static function batchGet(array $openIds, $lang = 'zh_CN') { $url = 'https://api.weixin.qq.com/cgi-bin/user/info/batchget?access_token=ACCESS_TOKEN'; $data = array(); foreach ($openIds as $openid) { $data[] = array('openid' => $openid, 'lang' => $lang); } $data = array('user_list' => $data); $result = parent::request($url, $data); return $result['user_info_list']; }
/** * Get all verified email addresses associated with an account * @param string $accessToken - Constant Contact OAuth2 Access Token * @param array $params - array of query parameters/values to append to the request * @return array of VerifiedEmailAddress */ public function getVerifiedEmailAddresses($accessToken, array $params) { $baseUrl = Config::get('endpoints.base_url') . sprintf(Config::get('endpoints.account_verified_addresses')); $url = $this->buildUrl($baseUrl, $params); $response = parent::getRestClient()->get($url, parent::getHeaders($accessToken)); $verifiedAddresses = array(); foreach (json_decode($response->body, true) as $verifiedAddress) { $verifiedAddresses[] = VerifiedEmailAddress::create($verifiedAddress); } return $verifiedAddresses; }
public function init() { if (SettingsManager::getInstance()->getSetting("Api: REST Api Enabled") == "1") { $user = BaseService::getInstance()->getCurrentUser(); $dbUser = new User(); $dbUser->Load("id = ?", array($user->id)); $resp = RestApiManager::getInstance()->getAccessTokenForUser($dbUser); if ($resp->getStatus() != IceResponse::SUCCESS) { LogManager::getInstance()->error("Error occured while creating REST Api acces token for " . $user->username); } } }
function includeModuleManager($type, $name, $data) { $moduleCapsName = ucfirst($name); $moduleTypeCapsName = ucfirst($type); // Admin or Modules $incFile = CLIENT_PATH . '/' . $type . '/' . $name . '/api/' . $moduleCapsName . $moduleTypeCapsName . "Manager.php"; include $incFile; $moduleManagerClass = $moduleCapsName . $moduleTypeCapsName . "Manager"; $moduleManagerObj = new $moduleManagerClass(); $moduleManagerObj->setModuleObject($data); $moduleManagerObj->setModuleType($type); BaseService::getInstance()->addModuleManager($moduleManagerObj); }
/** * Check and apply options. * * @since 1.0.0 * * @param array */ public function __construct($options) { // Let the base service do its work parent::__construct($options); // Validate title argument if (array_key_exists('title', $options) and !is_string($options['title'])) { throw new InvalidArgumentException('The "title" argument must be of type string.'); } // Validate via argument if (array_key_exists('via', $options) and !is_string($options['via'])) { throw new InvalidArgumentException('The "via" argument must be of type string.'); } // Apply arguments $this->title = isset($options['title']) ? $options['title'] : null; $this->via = isset($options['via']) ? $this->sanitizeViaArgument($options['via']) : null; }
public function execute($cron) { $email = new IceEmail(); $emails = $email->Find("status = ? limit 10", array('Pending')); $emailSender = BaseService::getInstance()->getEmailSender(); foreach ($emails as $email) { try { $emailSender->sendEmailFromDB($email); } catch (Exception $e) { LogManager::getInstance()->error("Error sending email:" . $e->getMessage()); } $email->status = 'Sent'; $email->updated = date('Y-m-d H:i:s'); $email->Save(); } }
public function changeTimeSheetStatus($req) { $employee = $this->baseService->getElement('Employee', $this->getCurrentProfileId(), null, true); $subordinate = new Employee(); $subordinates = $subordinate->Find("supervisor = ?", array($employee->id)); $subordinatesIds = array(); foreach ($subordinates as $sub) { $subordinatesIds[] = $sub->id; } $timeSheet = new EmployeeTimeSheet(); $timeSheet->Load("id = ?", array($req->id)); if ($timeSheet->id != $req->id) { return new IceResponse(IceResponse::ERROR, "Timesheet not found"); } if ($req->status == 'Submitted' && $employee->id == $timeSheet->employee) { } else { if (!in_array($timeSheet->employee, $subordinatesIds) && $this->user->user_level != 'Admin') { return new IceResponse(IceResponse::ERROR, "This Timesheet does not belong to any of your subordinates"); } } $oldStatus = $timeSheet->status; $timeSheet->status = $req->status; //Auto approve admin timesheets if ($req->status == 'Submitted' && BaseService::getInstance()->getCurrentUser()->user_level == "Admin") { $timeSheet->status = 'Approved'; } if ($oldStatus == $req->status) { return new IceResponse(IceResponse::SUCCESS, ""); } $ok = $timeSheet->Save(); if (!$ok) { LogManager::getInstance()->info($timeSheet->ErrorMsg()); } $timeSheetEmployee = $this->baseService->getElement('Employee', $timeSheet->employee, null, true); $this->baseService->audit(IceConstants::AUDIT_ACTION, "Timesheet [" . $timeSheetEmployee->first_name . " " . $timeSheetEmployee->last_name . " - " . date("M d, Y (l)", strtotime($timeSheet->date_start)) . " to " . date("M d, Y (l)", strtotime($timeSheet->date_end)) . "] status changed from:" . $oldStatus . " to:" . $req->status); if ($timeSheet->status == "Submitted" && $employee->id == $timeSheet->employee) { $notificationMsg = $employee->first_name . " " . $employee->last_name . " submitted timesheet from " . date("M d, Y (l)", strtotime($timeSheet->date_start)) . " to " . date("M d, Y (l)", strtotime($timeSheet->date_end)); $this->baseService->notificationManager->addNotification($employee->supervisor, $notificationMsg, '{"type":"url","url":"g=modules&n=time_sheets&m=module_Time_Management#tabSubEmployeeTimeSheetAll"}', IceConstants::NOTIFICATION_TIMESHEET); } else { if ($timeSheet->status == "Approved" || $timeSheet->status == "Rejected") { $notificationMsg = $employee->first_name . " " . $employee->last_name . " " . $timeSheet->status . " timesheet from " . date("M d, Y (l)", strtotime($timeSheet->date_start)) . " to " . date("M d, Y (l)", strtotime($timeSheet->date_end)); $this->baseService->notificationManager->addNotification($timeSheet->employee, $notificationMsg, '{"type":"url","url":"g=modules&n=time_sheets&m=module_Time_Management#tabEmployeeTimeSheetApproved"}', IceConstants::NOTIFICATION_TIMESHEET); } } return new IceResponse(IceResponse::SUCCESS, ""); }
public function getUserLeaveTypes() { $ele = new LeaveType(); $empLeaveGroupId = NULL; $employeeId = BaseService::getInstance()->getCurrentProfileId(); $empLeaveGroup = new LeaveGroupEmployee(); $empLeaveGroup->Load("employee = ?", array($employeeId)); if ($empLeaveGroup->employee == $employeeId && !empty($empLeaveGroup->id)) { $empLeaveGroupId = $empLeaveGroup->leave_group; } if (empty($empLeaveGroupId)) { $list = $ele->Find('leave_group IS NULL', array()); } else { $list = $ele->Find('leave_group IS NULL or leave_group = ?', array($empLeaveGroupId)); } return $list; }
private function getLastTimeSheetHours() { $timeSheet = new EmployeeTimeSheet(); $timeSheet->Load("employee = ? order by date_end desc limit 1", array(BaseService::getInstance()->getCurrentProfileId())); if (empty($timeSheet->employee)) { return new IceResponse(IceResponse::SUCCESS, "0:00"); } $timeSheetEntry = new EmployeeTimeEntry(); $list = $timeSheetEntry->Find("timesheet = ?", array($timeSheet->id)); $seconds = 0; foreach ($list as $entry) { $seconds += strtotime($entry->date_end) - strtotime($entry->date_start); } $minutes = (int) ($seconds / 60); $rem = $minutes % 60; $hours = ($minutes - $rem) / 60; if ($rem < 10) { $rem = "0" . $rem; } return new IceResponse(IceResponse::SUCCESS, $hours . ":" . $rem); }
include CLIENT_PATH . "/server.includes.inc.php"; $user = SessionUtils::getSessionObject('user'); $profileCurrent = null; $profileSwitched = null; $profileClass = ucfirst(SIGN_IN_ELEMENT_MAPPING_FIELD_NAME); $profileVar = SIGN_IN_ELEMENT_MAPPING_FIELD_NAME; if (!empty($user->{$profileVar})) { $profileCurrent = BaseService::getInstance()->getElement($profileClass, $user->{$profileVar}, null, true); if (!empty($profileCurrent)) { $profileCurrent = FileService::getInstance()->updateProfileImage($profileCurrent); } } if ($user->user_level == 'Admin' || $user->user_level == 'Manager') { $switchedEmpId = BaseService::getInstance()->getCurrentProfileId(); if ($switchedEmpId != $user->{$profileVar} && !empty($switchedEmpId)) { $profileSwitched = BaseService::getInstance()->getElement($profileClass, $switchedEmpId, null, true); if (!empty($profileSwitched)) { $profileSwitched = FileService::getInstance()->updateProfileImage($profileSwitched); } } } $activeProfile = null; if (!empty($profileSwitched)) { $activeProfile = $profileSwitched; } else { $activeProfile = $profileCurrent; } //read field templates $fieldTemplates = array(); $fieldTemplates['hidden'] = file_get_contents(CLIENT_PATH . '/templates/fields/hidden.html'); $fieldTemplates['text'] = file_get_contents(CLIENT_PATH . '/templates/fields/text.html');
public function __construct($po_request) { parent::__construct($po_request); }
public function getQuickAccessMenuItemsHTML() { $html = ""; $user = BaseService::getInstance()->getCurrentUser(); foreach ($this->quickAccessMenuItems as $item) { if (empty($item[3]) || in_array($user->user_level, $item[3])) { $html .= '<a href="' . $item[2] . '"><i class="fa ' . $item[1] . '"></i> ' . $item[0] . '</a>'; } } return $html; }
public function __construct() { parent::__construct(); $this->language->load('checkout/cart'); }
function __construct() { parent::__construct(); }
public function __construct($po_request) { parent::__construct($po_request); $this->opo_dm = Datamodel::load(); }
echo BASE_URL; ?> js/app-global.js"></script> </head> <body class="skin-blue"> <script> (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) })(window,document,'script','//www.google-analytics.com/analytics.js','ga'); ga('create', '<?php echo BaseService::getInstance()->getGAKey(); ?> ', 'gamonoid.com'); ga('send', 'pageview'); </script> <script type="text/javascript"> </script> <header id="delegationDiv" class="header"> <a href="<?php echo $homeLink; ?> " class="logo" style="font-family: 'Source Sans Pro', sans-serif;">
/** * * @param string $username * @param string $password */ public function __construct($username, $password) { parent::__construct($username, $password); $this->_service = "sms"; }