本文整理汇总了PHP中SJB_Request::getInt方法的典型用法代码示例。如果您正苦于以下问题:PHP SJB_Request::getInt方法的具体用法?PHP SJB_Request::getInt怎么用?PHP SJB_Request::getInt使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SJB_Request
的用法示例。
在下文中一共展示了SJB_Request::getInt方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: execute
public function execute()
{
$tp = SJB_System::getTemplateProcessor();
if (SJB_UserManager::isUserLoggedIn()) {
$user_id = SJB_UserManager::getCurrentUserSID();
$errors = array();
$id = SJB_Request::getInt('id', 0, 'GET');
$action = SJB_Request::getVar('action', '', 'GET');
if ($id > 0) {
// read message
if (SJB_PrivateMessage::isMyMessage($id)) {
if ($action == 'delete') {
SJB_PrivateMessage::delete(array($id));
SJB_HelperFunctions::redirect(SJB_System::getSystemSettings('SITE_URL') . '/private-messages/inbox/');
}
$message = SJB_PrivateMessage::readMessage($id);
SJB_Authorization::updateCurrentUserSession();
$current_user_info = SJB_UserManager::createTemplateStructureForCurrentUser();
$current_user_info['logged_in'] = true;
$current_user_info['new_messages'] = SJB_PrivateMessage::getCountUnreadMessages($current_user_info['id']);
SJB_System::setCurrentUserInfo($current_user_info);
$tp->assign('message', $message);
$tp->assign('include', 'message_detail.tpl');
} else {
$errors['NOT_EXISTS_MESSAGE'] = 1;
}
}
$tp->assign('errors', $errors);
$tp->assign('unread', SJB_PrivateMessage::getCountUnreadMessages($user_id));
$tp->display('main.tpl');
} else {
$tp->assign('return_url', base64_encode(SJB_Navigator::getURIThis()));
$tp->display('../users/login.tpl');
}
}
示例2: execute
public function execute()
{
$tp = SJB_System::getTemplateProcessor();
if (SJB_UserManager::isUserLoggedIn()) {
$user_id = SJB_UserManager::getCurrentUserSID();
if (SJB_Request::getVar('pm_action', '', SJB_Request::METHOD_POST) == 'delete') {
$checked = SJB_Request::getVar('pm_check', array(), SJB_Request::METHOD_POST);
SJB_PrivateMessage::delete($checked);
}
$page = intval(SJB_Request::getVar('page', 1, SJB_Request::METHOD_GET));
$messagesPerPage = SJB_Request::getInt('messagesPerPage', 10);
$total = SJB_PrivateMessage::getTotalOutbox($user_id);
$totalPages = ceil($total / $messagesPerPage);
if ($totalPages == 0) {
$totalPages = 1;
}
if (empty($page) || $page <= 0) {
$page = 1;
}
if ($totalPages < $page) {
SJB_HelperFunctions::redirect("?page={$totalPages}");
}
$list = SJB_PrivateMessage::getListOutbox($user_id, $page, $messagesPerPage);
$tp->assign('message_list', $list);
$tp->assign('messagesPerPage', $messagesPerPage);
$tp->assign('page', $page);
$tp->assign('totalPages', $totalPages);
$tp->assign('include', 'list_outbox.tpl');
$tp->assign('unread', SJB_PrivateMessage::getCountUnreadMessages($user_id));
}
$tp->display('main.tpl');
}
示例3: execute
public function execute()
{
if (class_exists('SJB_SocialPlugin') && in_array('linkedin', SJB_SocialPlugin::getAvailablePlugins()) && SJB_Settings::getSettingByName('li_memberProfileWidget')) {
$userSID = SJB_Request::getInt('profileSID', '');
if ($userSID && ($profilePublicUrl = SJB_SocialPlugin::getProfilePublicUrlByProfileID($userSID))) {
$tp = SJB_System::getTemplateProcessor();
$tp->assign('inPublicUrl', $profilePublicUrl);
$tp->display('linkedin_member_profile_widget.tpl');
}
}
}
示例4: jsRate
private function jsRate()
{
if (!SJB_UserManager::isUserLoggedIn()) {
exit;
}
$listing_sid = SJB_Request::getInt('listing', 0, SJB_Request::METHOD_POST);
$rate = SJB_Request::getInt('rate', 0, SJB_Request::METHOD_POST);
$new_rating = SJB_Rating::setRaiting($rate, $listing_sid, SJB_UserManager::getCurrentUserSID());
if (isset($new_rating['rating'])) {
echo $new_rating['rating'];
}
}
示例5: execute
public function execute()
{
if (SJB_Request::isAjax()) {
die(json_encode($this->getPayPalStateList()));
}
$getInvoiceId = SJB_Request::getInt('payment_id', 0, 'GET');
$this->invoice = SJB_InvoiceManager::getObjectBySID($getInvoiceId);
if ($this->invoiceValidation($this->invoice)) {
if ($this->isPayNowButtonPressed()) {
$this->processPayNowButtonClick();
} else {
$this->displayForm();
}
}
}
示例6: execute
public function execute()
{
$tp = SJB_System::getTemplateProcessor();
if (SJB_UserManager::isUserLoggedIn()) {
$userSID = SJB_UserManager::getCurrentUserSID();
$action = SJB_Request::getVar('pm_action', null);
if ($action) {
$checked = SJB_Request::getVar('pm_check', array(), 'POST');
switch ($action) {
case 'delete':
SJB_PrivateMessage::deleteContact($userSID, $checked);
break;
case 'save_contact':
$error = '';
$contactSID = SJB_Request::getInt('user_id', 0);
SJB_PrivateMessage::saveContact($userSID, $contactSID, $error);
$tp->assign('error', $error);
$tp->display('contact_save.tpl');
return true;
break;
default:
break;
}
}
$page = SJB_Request::getInt('page', 1, 'GET');
$contactsPerPage = SJB_Request::getInt('contactsPerPage', 10);
SJB_PrivateMessage::deleteNonexistentContacts($userSID);
$total = SJB_PrivateMessage::getTotalContacts($userSID);
$totalPages = ceil($total / $contactsPerPage);
if ($totalPages == 0) {
$totalPages = 1;
}
if (empty($page) || $page <= 0) {
$page = 1;
}
if ($totalPages < $page) {
SJB_HelperFunctions::redirect("?page={$totalPages}");
}
$tp->assign('message_list', SJB_PrivateMessage::getContacts($userSID, $page, $contactsPerPage));
$tp->assign('contactsPerPage', $contactsPerPage);
$tp->assign('page', $page);
$tp->assign('totalPages', $totalPages);
$tp->assign('include', 'contacts.tpl');
$tp->assign('unread', SJB_PrivateMessage::getCountUnreadMessages($userSID));
}
$tp->display('main.tpl');
}
示例7: execute
public function execute()
{
$tp = SJB_System::getTemplateProcessor();
if (SJB_UserManager::isUserLoggedIn()) {
$user_id = SJB_UserManager::getCurrentUserSID();
$action = SJB_Request::getVar('pm_action', SJB_Request::METHOD_POST, false);
if ($action) {
$checked = SJB_Request::getVar('pm_check', SJB_Request::METHOD_POST, array());
switch ($action) {
case 'mark':
SJB_PrivateMessage::markAsRead($checked);
SJB_HelperFunctions::redirect(SJB_System::getSystemSettings('SITE_URL') . '/private-messages/inbox/');
break;
case 'delete':
SJB_PrivateMessage::delete($checked);
SJB_HelperFunctions::redirect(SJB_System::getSystemSettings('SITE_URL') . '/private-messages/inbox/');
break;
default:
break;
}
}
$page = SJB_Request::getInt('page', 1, 'GET');
$messagesPerPage = SJB_Request::getInt('messagesPerPage', 10);
$total = SJB_PrivateMessage::getTotalInbox($user_id);
$totalPages = ceil($total / $messagesPerPage);
if ($totalPages == 0) {
$totalPages = 1;
}
if (empty($page) || $page <= 0) {
$page = 1;
}
if ($totalPages < $page) {
SJB_HelperFunctions::redirect("?page={$totalPages}");
}
$tp->assign('message_list', SJB_PrivateMessage::getListInbox($user_id, $page, $messagesPerPage));
$tp->assign('include', 'list_inbox.tpl');
$tp->assign('messagesPerPage', $messagesPerPage);
$tp->assign('page', $page);
$tp->assign('totalPages', $totalPages);
$tp->assign('unread', SJB_PrivateMessage::getCountUnreadMessages($user_id));
}
$tp->display('main.tpl');
}
示例8: execute
public function execute()
{
$this->tp = SJB_System::getTemplateProcessor();
$passedParametersViaUri = SJB_UrlParamProvider::getParams();
$promotionSID = array_shift($passedParametersViaUri);
$promotionCodeInfo = SJB_PromotionsManager::getCodeInfoBySID($promotionSID);
$this->tp->assign('promotionInfo', $promotionCodeInfo);
if (!$promotionCodeInfo) {
array_push($this->errors, 'INVALID_ID');
}
$page = SJB_Request::getInt('page', 1);
$itemsPerPage = SJB_Request::getInt('items_per_page', 50);
$itemsCount = SJB_PromotionsManager::getHistoryCountBySID($promotionSID);
$this->assignParametersForPagination($page, $itemsPerPage, $itemsCount);
$promotions = SJB_PromotionsManager::getHistoryBySID($promotionSID, $page, $itemsPerPage);
SJB_PromotionsManager::preparePromotionsInfoForLog($promotions);
$currency = SJB_CurrencyManager::getDefaultCurrency();
$this->tp->assign('currency', $currency);
$this->tp->assign('promotions', $promotions);
$this->tp->assign('errors', $this->errors);
$this->tp->display('promotions_log.tpl');
}
示例9: execute
public function execute()
{
$tp = SJB_System::getTemplateProcessor();
$action = SJB_Request::getVar('action_name', false);
$action = $action ? $action : 'list';
$template = 'manage_polls.tpl';
$errors = array();
switch ($action) {
case 'new':
$template = 'input_form_poll.tpl';
$_REQUEST['start_date'] = date('Y-m-d');
$field = new SJB_PollsManager($_REQUEST);
$form = new SJB_Form($field);
$form->registerTags($tp);
$tp->assign('form_fields', $form->getFormFieldsInfo());
break;
case 'save':
$sid = SJB_Request::getVar('sid');
$_REQUEST['value'] = strip_tags(SJB_Request::getVar('value'));
$_REQUEST['user_group_sid'] = SJB_Request::getInt('user_group_sid', 0);
$field = new SJB_PollsManager($_REQUEST);
if ($sid) {
$field->setSID($sid);
}
$form = new SJB_Form($field);
if ($form->isDataValid($errors)) {
SJB_PollsManager::savePoll($field);
$_REQUEST['sid'] = $field->sid;
$save = SJB_Request::getVar('save', false);
$action = 'edit';
if ($save) {
SJB_HelperFunctions::redirect(SJB_System::getSystemSettings('SITE_URL') . '/manage-polls/');
break;
}
} else {
$action = 'new';
if ($sid) {
$action = 'edit';
}
$template = 'input_form_poll.tpl';
$field->setSID($sid);
$form->registerTags($tp);
$tp->assign('form_fields', $form->getFormFieldsInfo());
$tp->assign('errors', $errors);
$tp->assign('sid', $sid);
break;
}
case 'edit':
$sid = SJB_Request::getVar('sid');
$info = SJB_PollsManager::getPollInfoBySID($sid);
$field = new SJB_PollsManager($info);
$edit_form = new SJB_Form($field);
$edit_form->registerTags($tp);
$field->setSID($sid);
$tp->assign('form_fields', $edit_form->getFormFieldsInfo());
$tp->assign('sid', $sid);
$tp->assign('action', 'edit');
$template = 'input_form_poll.tpl';
break;
case 'edit_answer':
$sid = SJB_Request::getVar('sid');
$_REQUEST['field_sid'] = $sid;
$event = SJB_Request::getVar('event');
$pollInfo = SJB_PollsManager::getPollInfoBySID($sid);
$edit_list_controller = new SJB_PollsEditListController($_REQUEST, $pollInfo);
switch ($event) {
case 'add':
$item_sid = SJB_Request::getVar('item_sid');
if ($edit_list_controller->isValidValueSubmitted()) {
if ($item_sid) {
$pollItemManager = new SJB_PollsListItemManager();
$list_item = $pollItemManager->getListItemBySID($item_sid);
$list_item->setValue(trim($_REQUEST['list_item_value']));
$pollItemManager->saveListItem($list_item);
} else {
if (!$edit_list_controller->saveItem()) {
$tp->assign('error', 'LIST_VALUE_ALREADY_EXISTS');
}
}
} else {
$tp->assign('error', 'LIST_VALUE_IS_EMPTY');
}
break;
case 'edit':
$item_sid = SJB_Request::getVar('item_sid');
$pollItemManager = new SJB_PollsListItemManager();
$list_item = $pollItemManager->getListItemBySID($item_sid);
$tp->assign('item_sid', $list_item->sid);
$tp->assign('item_value', $list_item->value);
$tp->assign('item_action', 'edit');
break;
case 'add_multiple':
if ($edit_list_controller->isValidMultiValueSubmitted()) {
if (!$edit_list_controller->saveItem(true)) {
$tp->assign('error', 'LIST_VALUE_ALREADY_EXISTS');
}
} else {
$tp->assign('error', 'LIST_VALUE_IS_EMPTY');
}
break;
//.........这里部分代码省略.........
示例10: execute
public function execute()
{
$field_sid = isset($_REQUEST['field_sid']) ? $_REQUEST['field_sid'] : null;
$field_info = SJB_UserProfileFieldManager::getFieldInfoBySID($field_sid);
$node_sid = isset($_REQUEST['node_sid']) ? $_REQUEST['node_sid'] : 0;
$user_group_sid = isset($_REQUEST['user_group_sid']) ? $_REQUEST['user_group_sid'] : null;
$user_group_info = SJB_UserGroupManager::getUserGroupInfoBySID($user_group_sid);
if (empty($field_info)) {
$errors['INVALID_FIELD_SID'] = 1;
} else {
if (isset($_REQUEST['action']) && $_REQUEST['action'] == 'add') {
$tree_item_value = $_REQUEST['tree_item_value'];
$order = $_REQUEST['order'];
if ($tree_item_value == '') {
$field_errors['Value'] = 'EMPTY_VALUE';
} else {
if ($order == 'begin') {
SJB_UserProfileFieldManager::addTreeItemToBeginByParentSID($field_sid, $node_sid, $tree_item_value);
} elseif ($order == 'end') {
SJB_UserProfileFieldManager::addTreeItemToEndByParentSID($field_sid, $node_sid, $tree_item_value);
} elseif ($order == 'after') {
$after_tree_item_sid = $_REQUEST['after_tree_item_sid'];
SJB_UserProfileFieldManager::addTreeItemAfterByParentSID($field_sid, $node_sid, $tree_item_value, $after_tree_item_sid);
}
$treeLevelsNumber = SJB_UserProfileFieldTreeManager::getTreeDepthBySID($field_sid);
SJB_UserProfileFieldManager::addLevelField($treeLevelsNumber);
}
} elseif (isset($_REQUEST['action']) && $_REQUEST['action'] == 'save') {
$tree_item_value = $_REQUEST['tree_item_value'];
if (empty($tree_item_value)) {
$field_errors['Value'] = 'EMPTY_VALUE';
} else {
SJB_UserProfileFieldManager::updateTreeItemBySID($node_sid, $tree_item_value);
$order = isset($_REQUEST['order']) ? $_REQUEST['order'] : null;
if ($order == 'begin') {
SJB_UserProfileFieldManager::moveTreeItemToBeginBySID($node_sid);
} elseif ($order == 'end') {
SJB_UserProfileFieldManager::moveTreeItemToEndBySID($node_sid);
} elseif ($order == 'after') {
$after_tree_item_sid = $_REQUEST['after_tree_item_sid'];
SJB_UserProfileFieldManager::moveTreeItemAfterBySID($node_sid, $after_tree_item_sid);
}
}
} elseif (isset($_REQUEST['action']) && $_REQUEST['action'] == 'delete') {
$item_sid = isset($_REQUEST['item_sid']) ? $_REQUEST['item_sid'] : null;
SJB_UserProfileFieldManager::deleteTreeItemBySID($item_sid);
} elseif (isset($_REQUEST['action']) && $_REQUEST['action'] == 'move_up') {
$item_sid = isset($_REQUEST['item_sid']) ? $_REQUEST['item_sid'] : null;
SJB_UserProfileFieldManager::moveUpTreeItem($item_sid);
} elseif (isset($_REQUEST['action']) && $_REQUEST['action'] == 'move_down') {
$item_sid = isset($_REQUEST['item_sid']) ? $_REQUEST['item_sid'] : null;
SJB_UserProfileFieldManager::moveDownTreeItem($item_sid);
} elseif (isset($_REQUEST['action']) && $_REQUEST['action'] == 'add_multiple') {
$node_sid = isset($_REQUEST['node_sid']) ? SJB_Request::getInt('node_sid') : 0;
$item_sid = SJB_Request::getVar('field_sid');
$tree_item_value = SJB_Request::getVar('tree_multiItem_value', false);
$after_tree_item_sid = SJB_Request::getVar('after_tree_item_sid', 0);
$order = SJB_Request::getVar('order', false);
if ($tree_item_value == '') {
$field_errors['Value'] = 'EMPTY_VALUE';
}
SJB_UserProfileFieldTreeManager::addMultupleTreeItem($item_sid, $node_sid, $tree_item_value, $order, $after_tree_item_sid);
}
$tree_items = SJB_UserProfileFieldManager::getTreeValuesByParentSID($field_sid, $node_sid);
$parent_sid = SJB_UserProfileFieldManager::getTreeParentSID($node_sid);
$tree_parent_items = SJB_UserProfileFieldManager::getTreeValuesByParentSID($field_sid, $parent_sid);
}
$tp = SJB_System::getTemplateProcessor();
$tp->assign("field_sid", $field_sid);
$tp->assign("node_sid", $node_sid);
$tp->assign("user_group_sid", $user_group_sid);
$tp->assign("user_group_info", $user_group_info);
$tp->assign("field_info", $field_info);
$tp->assign("tree_parent_items", $tree_parent_items);
$tp->assign("tree_items", $tree_items);
$node_info = SJB_UserProfileFieldManager::getTreeItemInfoBySID($node_sid);
$node_path = SJB_UserProfileFieldManager::getTreeNodePath($node_sid);
$node_path[0] = array('caption' => 'Root', 'sid' => 0);
$node_info['node_path'] = $node_path;
$tp->assign("node_info", $node_info);
$current_level = isset($node_info['level']) ? $node_info['level'] : 0;
$tp->assign("current_level", $current_level);
$tp->assign("errors", isset($errors) ? $errors : null);
$tp->assign("field_errors", isset($field_errors) ? $field_errors : null);
$tp->display("edit_tree.tpl");
}
示例11: execute
public function execute()
{
set_time_limit(0);
ini_set('memory_limit', -1);
$tp = SJB_System::getTemplateProcessor();
$user_groups_info = SJB_UserGroupManager::getAllUserGroupsInfo();
$user_group_info = reset($user_groups_info);
$user_group_sid = $user_group_info['sid'];
$fields_info = SJB_UserProfileFieldManager::getFieldsInfoByUserGroupSID($user_group_sid);
$fields = array();
$tp->assign('test_message', SJB_Request::getVar('test_message', false));
$tp->assign('undeliveredMailingsForTest', SJB_Request::getVar('undeliveredMailingsForTest', false));
foreach ($fields_info as $key => $val) {
if ($val['id'] == 'Location') {
foreach ($val['fields'] as $field) {
if ($field['id'] == 'Country') {
$fields['country'] = SJB_CountriesManager::getAllCountriesCodesAndNames();
} elseif ($field['id'] == 'State') {
$fields['state'] = SJB_StatesManager::getStatesNamesByCountry();
}
}
}
}
$tp->assign('fields', $fields);
$errors = array();
$errorId = SJB_Request::getVar('error', null, 'GET');
if ($errorId) {
$errors[$errorId] = 1;
}
if (isset($_REQUEST['submit']) && $_FILES['file_mail']['name'] && $_FILES['file_mail']['error']) {
$errorId = SJB_UploadFileManager::getErrorId($_FILES['file_mail']['error']);
if ($_REQUEST['submit'] != 'save') {
$mailID = SJB_Request::getVar('mail_id', 0);
$parameter = $mailID ? '?edit=' . $mailID : '';
SJB_HelperFunctions::redirect(SJB_System::getSystemSettings('SITE_URL') . '/mailing/' . $parameter . '&error=' . $errorId);
}
$errors[$errorId] = 1;
} else {
if (isset($_REQUEST['submit'])) {
SJB_DB::query("DELETE FROM uploaded_files WHERE id = 'file_mail'");
$upload_manager = new SJB_UploadFileManager();
$upload_manager->setFileGroup('files');
$upload_manager->setUploadedFileID('file_mail');
$upload_manager->uploadFile('file_mail');
$file_name = '';
if (!isset($_REQUEST['delete_file']) && isset($_REQUEST['old_file']) && !$upload_manager->getUploadedFileName('file_mail')) {
$file_name = $_REQUEST['old_file'];
} elseif ($upload_manager->getUploadedFileName('file_mail')) {
$file_name = "files/files/" . $upload_manager->getUploadedSavedFileName('file_mail');
}
$language = SJB_Request::getVar('language', 'any');
$users = SJB_Request::getVar('users', 'any');
$without_cv = SJB_Request::getVar('without_cv', false);
$country = SJB_Request::getVar('country', '');
$state = SJB_Request::getVar('state', '');
$city = SJB_Request::getVar('city', '');
$products = SJB_Request::getVar('products', array());
$user_status = SJB_Request::getVar('user_status', '');
$registration_date = SJB_Request::getVar('registration_date', array());
$param = serialize(array('language' => $language, 'users' => $users, 'without_cv' => $without_cv, 'products' => $products, 'country' => $country, 'state' => $state, 'city' => $city, 'status' => $user_status, 'registration' => $registration_date));
$email = '';
$mailSubject = SJB_Request::getVar('subject', '');
$mailText = stripcslashes(SJB_Request::getVar('text', ''));
$mailID = SJB_Request::getVar('mail_id', 0);
if ($mailID) {
SJB_DB::query('UPDATE `mailing` SET
`subject` = ?s,
`text` = ?s,
`email` = ?s,
`file` = ?s,
`param` = ?s
WHERE `id` = ?s', $mailSubject, $mailText, $email, $file_name, $param, $mailID);
} else {
$query = "INSERT INTO mailing ( email , subject , text , file, param) VALUES ( ?s, ?s, ?s, ?s, ?s)";
SJB_DB::query($query, $email, $mailSubject, $mailText, $file_name, $param);
}
if ($_REQUEST['submit'] == 'save') {
SJB_HelperFunctions::redirect(SJB_System::getSystemSettings('SITE_URL') . '/mailing/');
} else {
$parameter = $mailID ? '?edit=' . $mailID : '';
SJB_HelperFunctions::redirect(SJB_System::getSystemSettings('SITE_URL') . '/mailing/' . $parameter);
}
}
}
if (SJB_Request::getVar('delete')) {
$mailings = SJB_Request::getVar('mailing');
if (is_array($mailings)) {
foreach ($mailings as $id => $value) {
SJB_DB::query('DELETE FROM `mailing` WHERE `id` = ?n', $id);
SJB_DB::query('DELETE FROM `mailing_info` WHERE `mailing_id` = ?n', $id);
}
} else {
$idToDelete = SJB_Request::getInt('delete', 0);
SJB_DB::query('DELETE FROM `mailing` WHERE `id` = ?n', $idToDelete);
SJB_DB::query('DELETE FROM `mailing_info` WHERE `mailing_id` = ?n', $idToDelete);
}
SJB_HelperFunctions::redirect(SJB_System::getSystemSettings('SITE_URL') . '/mailing/');
}
if (isset($_REQUEST['edit'])) {
$idToEdit = SJB_Request::getInt('edit', 0);
//.........这里部分代码省略.........
示例12: displayAsSelectBoxes
public function displayAsSelectBoxes()
{
$parentSID = SJB_Request::getInt('parentSID');
$this->_treeValues = $this->_treeManager->getTreeItemsByParentSIDAndFieldSID($this->_fieldSID, $parentSID);
if (!empty($this->_treeValues)) {
$level = $this->_treeValues[$parentSID][0]['level'];
$aLevel = $this->_treeManager->getTreePropertyByTreeSID($this->_fieldSID);
$levelCaption = SJB_Array::get($aLevel, 'level_' . $level);
} else {
return false;
}
// TRANSLATE & Order BY Alphabet
$this->translateAndMakeOrderTreeValues();
$this->prepareValuesForDisplayAsTreeSearchForm();
$tp = SJB_System::getTemplateProcessor();
$tp->assign('tree_values', $this->_treeValues);
$tp->assign('levelName', $levelCaption);
$tp->assign('level', $level);
$tp->assign('has_child', true);
$tp->assign('fieldSID', $this->_fieldSID);
$tp->assign('name', $this->_fieldName);
$tp->assign('checked', $this->_checked);
$tp->display('tree_display_as_select.tpl');
}
示例13: execute
public function execute()
{
$tp = SJB_System::getTemplateProcessor();
if (SJB_UserManager::isUserLoggedIn()) {
$user_id = SJB_UserManager::getCurrentUserSID();
$id = SJB_Request::getInt('id', 0, 'GET');
if ($id > 0) {
$errors = array();
if (isset($_POST['form_to'])) {
$to_user_name = isset($_POST['form_to']) ? strip_tags($_POST['form_to']) : '';
$to_user_info = SJB_UserManager::getUserInfoByUserName($to_user_name);
$to_user = isset($to_user_info['sid']) ? $to_user_info['sid'] : 0;
$subject = isset($_POST['form_subject']) ? strip_tags($_POST['form_subject']) : '';
$text = isset($_POST['form_message']) ? SJB_PrivateMessage::cleanText($_POST['form_message']) : '';
$save = isset($_POST['form_save']) ? true : false;
$reply_id = isset($_POST['reply_id']) ? $_POST['reply_id'] : false;
if ($to_user == 0) {
$errors['form_to'] = 'You specified wrong username';
}
if (empty($subject)) {
$errors['form_subject'] = 'Please, enter message subject';
}
if (empty($text)) {
$errors['form_message'] = 'Please, enter message';
}
if (count($errors) == 0) {
$anonym = SJB_Request::getVar('anonym');
SJB_PrivateMessage::sendMessage($user_id, $to_user, $subject, $text, $save, $reply_id, false, $anonym);
// save to contacts
if (!$anonym) {
SJB_PrivateMessage::saveContact($user_id, $to_user);
SJB_PrivateMessage::saveContact($to_user, $user_id);
}
SJB_HelperFunctions::redirect(SJB_System::getSystemSettings('SITE_URL') . '/private-messages/inbox/');
} else {
$message['to_name'] = htmlentities($to_user_name, ENT_QUOTES, "UTF-8");
$message['subject'] = htmlentities($subject, ENT_QUOTES, "UTF-8");
$message['message'] = $text;
$tp->assign('save', $save);
}
} else {
if (SJB_PrivateMessage::isMyMessage($id)) {
$message = SJB_PrivateMessage::readMessage($id);
} else {
$errors['NOT_EXISTS_MESSAGE'] = 1;
$message = '';
}
if ($message) {
$message['to_name'] = htmlentities($message['from_name'], ENT_QUOTES, "UTF-8");
$message['subject'] = 'RE: ' . htmlentities($message['subject'], ENT_QUOTES, "UTF-8");
$message['message'] = '<p> </p><blockquote class="pmQuote">' . $message['message'] . '</blockquote>';
}
$tp->assign('reply_id', $id);
}
}
$tp->assign('errors', $errors);
$tp->assign('include', 'reply_message.tpl');
$tp->assign('message', $message);
$tp->assign('unread', SJB_PrivateMessage::getCountUnreadMessages($user_id));
$tp->display('main.tpl');
} else {
$tp->assign('return_url', base64_encode(SJB_Navigator::getURIThis()));
$tp->display('../users/login.tpl');
}
}
示例14: setPaymentStatus
private function setPaymentStatus()
{
$invoiceSid = SJB_Request::getInt('item_number', null);
if (is_null($invoiceSid)) {
$this->errors['INVOICE_ID_IS_NOT_SET'] = 1;
return null;
}
$invoice = SJB_InvoiceManager::getObjectBySID($invoiceSid);
$status = false;
if (is_null($invoice)) {
$this->errors['NONEXISTED_INVOICE_ID_SPECIFIED'] = 1;
return null;
}
if ($invoice->isRecurring()) {
foreach ($this->httpParsedResponseOfRecurring as $key => $response) {
if (in_array(strtoupper($response['ACK']), array('SUCCESS', 'SUCCESSWITHWARNING'))) {
$status = true;
}
}
if ($status == true) {
$invoice->setStatus(SJB_Invoice::INVOICE_STATUS_PENDING);
} else {
$invoice->setStatus(SJB_Invoice::INVOICE_STATUS_UNPAID);
}
SJB_InvoiceManager::saveInvoice($invoice);
} else {
$invoice->setCallbackData($this->httpParsedResponseAr);
if (in_array(strtoupper($this->httpParsedResponseAr['ACK']), array('SUCCESS', 'SUCCESSWITHWARNING'))) {
$invoice->setStatus(SJB_Invoice::INVOICE_STATUS_VERIFIED);
} else {
$invoice->setStatus(SJB_Invoice::INVOICE_STATUS_UNPAID);
}
SJB_InvoiceManager::saveInvoice($invoice);
}
}