Beispiel #1
0
    function render($args, $instance)
    {
        global $gantry;
        ob_start();
        ?>
            <div id="rt-accessibility">
                <div class="rt-desc"><?php 
        _ge($instance['text']);
        ?>
</div>
                <div id="rt-buttons">
                    <a href="<?php 
        echo $gantry->addQueryStringParams($gantry->getCurrentUrl(array('reset-settings')), array('font-size' => 'smaller'));
        ?>
" title="<?php 
        echo _g('Decrease Font Size');
        ?>
" class="small"><span class="button"></span></a>
                    <a href="<?php 
        echo $gantry->addQueryStringParams($gantry->getCurrentUrl(array('reset-settings')), array('font-size' => 'larger'));
        ?>
" title="<?php 
        echo _g('Increase Font Size');
        ?>
" class="large"><span class="button"></span></a>
                </div>
            </div>
            <div class="clear"></div>
	    <?php 
        echo ob_get_clean();
    }
Beispiel #2
0
 public function __construct()
 {
     if (!isset($_SESSION)) {
         $this->initEnvironment();
     } else {
         if (!validSession()) {
             die(_g('The session is invalid, please login again'));
         }
     }
     try {
         $this->initSmarty();
         TableMng::init();
         $this->_adminInterface = new AdminInterface(NULL, $this->_smarty);
         // AdminInterface has used global $smarty, workaround
         AdminInterface::$smartyHelper = $this->_smarty;
         $this->_moduleExecutionParser = new ModuleExecutionInputParser();
         $this->_moduleExecutionParser->setSubprogramPath('root/administrator');
         $this->loadVersion();
         $this->initDatabaseConnections();
         $this->_logger = new Logger($this->_pdo);
         $this->_logger->categorySet('Administrator');
         $this->_acl = new Acl($this->_logger, $this->_pdo);
     } catch (MySQLConnectionException $e) {
         die('Sorry, could not connect to the database.');
     }
 }
Beispiel #3
0
 function edit()
 {
     global $basedomain, $app_domain;
     $userid['id'] = intval(_g('id'));
     $dataUser = $this->userHelper->getListUser($userid);
     if ($dataUser) {
         $getIndustri = $this->contentHelper->getIndustri($dataUser[0]['industri_id']);
         foreach ($dataUser as $key => $value) {
             $dataUser[$key]['perusahaan'] = $getIndustri[0];
         }
     }
     if (_p('token')) {
         // upload image
         $uploadImage['status'] = false;
         if ($_FILES['image']['name'] != "") {
             $uploadImage = uploadFile('image', 'user');
         }
         $dataarr = array();
         $userid = intval(_p('id'));
         $addUser = $this->userHelper->updateUserProfile($dataarr, $userid);
         if ($uploadImage['status']) {
             $updateUser = $this->userHelper->updateUserImage($uploadImage['filename'], $addUser);
         }
         if ($addUser) {
             redirect($basedomain . 'user');
         }
         exit;
     }
     // pr($dataUser);
     $this->view->assign('data', $dataUser[0]);
     return $this->loadView('user-detail');
 }
Beispiel #4
0
 public function getInput()
 {
     global $gantry;
     $buffer = '';
     // get the sets just below
     foreach ($this->fields as $field) {
         if ($field->type == 'set') {
             $this->sets[] = $field;
         }
     }
     $buffer .= "<div class='wrapper'>\n";
     foreach ($this->fields as $field) {
         if ((string) $field->type != 'set') {
             $selector = false;
             $enabler = false;
             if ($field->element['enabler'] && strtolower((string) $field->element['enabler']) == 'true') {
                 $this->enabler = $field;
                 $enabler = true;
             }
             if ($field->element['selector'] && (string) $field->element['selector'] == true) {
                 $field->detached = false;
                 $selector = true;
                 if ($field != $this->enabler && isset($this->enabler) && (int) $this->enabler->value == 0) {
                     $field->detached = true;
                 }
                 foreach ($this->sets as $set) {
                     //Create a new option object based on the <option /> element.
                     $tmp = GantryHtmlSelect::option((string) $set->element['name'], _g(trim((string) $set->element['label'])), 'value', 'text', (string) $set->element['disabled'] == 'true');
                     // Set some option attributes.
                     $tmp->class = (string) $set->element['class'];
                     // Set some JavaScript option attributes.
                     $tmp->onclick = (string) $set->element['onclick'];
                     // Add the option object to the result set.
                     //$options[] = $tmp;
                     $field->addOption($tmp);
                 }
             }
             $this->activeSet[$field->type] = $field->value;
             //array_push(array($field->type => $field->value), $this->activeSet);
             $itemName = $this->fieldname . "-" . $field->fieldname;
             $buffer .= '<div class="chain ' . $itemName . ' chain-' . strtolower($field->type) . '">' . "\n";
             if (strlen($field->getLabel())) {
                 $buffer .= '<span class="chain-label">' . _g($field->getLabel()) . '</span>' . "\n";
             }
             if ($selector) {
                 $buffer .= '<div class="selectedset-switcher">' . "\n";
             }
             if ($enabler) {
                 $buffer .= '<div class="selectedset-enabler">' . "\n";
             }
             $buffer .= $field->getInput();
             if ($selector || $enabler) {
                 $buffer .= '</div>' . "\n";
             }
             $buffer .= "</div>" . "\n";
         }
     }
     $buffer .= "</div>" . "\n";
     return $buffer;
 }
 public function displayDeleteSchoolYearConfirmation($schoolyear)
 {
     $promptMessage = sprintf(_g('Do you really want to delete the Schoolyear "%s"? WARNING: Problems will occur if you do this! Not all parts of the system support this!', $schoolyear->getLabel()));
     $actionString = 'deleteSchoolYear&ID=' . $schoolyear->getId();
     $confirmedString = _g('Yes, I want to break the System and delete the Schoolyear');
     $notConfirmedString = _g('No, I do not want to break the System and delete the Schoolyear');
     $this->confirmationDialog($promptMessage, $this->sectionString, $actionString, $confirmedString, $notConfirmedString);
 }
 function validate()
 {
     $data = _g('ref');
     // exit;
     logFile($data);
     if ($data) {
         $decode = unserialize(decode($data));
         // check if token is valid
         $salt = "register";
         $userMail = $decode['email'];
         $origToken = sha1($salt . $userMail);
         $token = sha1('reset' . $decode['email']);
         $getToken = $this->loginHelper->getEmailToken($decode['username']);
         if ($getToken['email_token'] == $decode['validby']) {
             if ($decode['reset']) {
                 $msg = $this->msg->display('all', false);
                 $this->view->assign('msg', $msg);
                 $ses_user = $this->loginHelper->getUserEmail($userMail, true);
                 $newData['login'] = $ses_user;
                 $this->view->assign('user', $newData);
                 $this->view->assign('reset', true);
                 return $this->loadView('user/reset');
             } else {
                 if ($decode['token'] == $origToken) {
                     // is valid, then create account and set status to validate
                     if ($decode['regfrom'] == 1) {
                         $this->view->assign('enterAccount', false);
                         $updateAccount = $this->loginHelper->updateUserStatus($decode['username']);
                         if ($updateAccount) {
                             $this->activityHelper->updateEmailLog(true, $userMail, 'account', 2);
                             $dataUSer['username'] = $decode['username'];
                             $dataUSer['password'] = $decode['password'];
                             createAccount($dataUSer);
                             logFile('account ftp user ' . $decode['email'] . ' created');
                             $this->view->assign('validate', 'Validate account success');
                         } else {
                             $this->view->assign('validate', 'Validate account error');
                             logFile('update n_status user ' . $decode['email'] . ' failed');
                         }
                     } else {
                         $this->view->assign('email', $decode['email']);
                         $this->view->assign('enterAccount', true);
                         return $this->loadView('validateProfile');
                     }
                 } else {
                     // invalid token
                     $this->view->assign('validate', 'Validate account error');
                     logFile('token mismatch');
                 }
             }
         } else {
             // invalid token
             $this->view->assign('validate', 'Validate account error');
             logFile('token mismatch');
         }
     }
     return $this->loadView('home');
 }
Beispiel #7
0
 function __construct($id = 'entity_name', $action = '', $method = 'POST', $css = 'form-horizontal admin-form')
 {
     $this->id = $id;
     $this->action = '';
     //$action;
     $this->method = $method;
     $this->css = $css;
     $this->ret = _g('r', false);
 }
 function __construct()
 {
     if (empty($this->short_name) || empty($this->long_name)) {
         die("A widget must have a valid type and classname defined");
     }
     $widget_options = array('classname' => $this->css_classname, 'description' => _g($this->description));
     $control_options = array('width' => $this->width, 'height' => $this->height);
     parent::__construct($this->wp_name, $this->long_name, $widget_options, $control_options);
 }
 /**
  * Checks if the Table for the Temporary assignUsersToClasses data exists
  *
  * Dies displaying a Message when the Query could not be executed
  *
  * @return boolean true if it exists, else false
  */
 protected function tableExists()
 {
     try {
         $stmt = $this->_pdo->query('SHOW TABLES LIKE "KuwasysTemporaryRequestsAssign";');
     } catch (PDOException $e) {
         $this->_interface->dieError(_g('Could not check if the UsersToClasses-Table exists!') . $e->getMessage());
     }
     return (bool) $stmt->fetch();
 }
Beispiel #10
0
 public function execute($dataContainer)
 {
     $this->entryPoint($dataContainer);
     if (isset($_GET['ID'])) {
         $this->dataFetch();
         $this->displayTpl('change.tpl');
     } else {
         $this->_interface->dieError(_g('Missing id of the user!'));
     }
 }
 /**
  * Resets the userpasswords to the preset Password
  * Excludes the User with the ID 1, since he is usually the SuperUser
  */
 protected function resetUserPasswords()
 {
     $presetPassword = $this->presetPasswordGet();
     if ($presetPassword) {
         $this->_pdo->query("UPDATE SystemUsers\n\t\t\t\tSET password = '******'\n\t\t\t\tWHERE ID <> 1");
     } else {
         $this->_interface->dieError(_g('Please set the preset password ' . 'before reseting the users passwords.'));
     }
     $this->_interface->dieSuccess(_g('The passwords were successfully resetted to the preset password.'));
 }
 /**
  * Checks if a session already exists
  * @return bool  true when a session already exists
  */
 private function sessionExists()
 {
     try {
         $res = $this->_pdo->query('SHOW TABLES LIKE "UserUpdateTempUsers"');
         return count($res->fetchAll()) > 0;
     } catch (\PDOException $e) {
         $this->_logger->log('Error checking for already existing Session', 'Notice', Null, json_encode(array('msg' => $e->getMessage())));
         $this->_interface->dieError(_g('Could not check if this has done before!'));
     }
 }
Beispiel #13
0
    /**
     * Fetches the helptext from the database
     * @return string The helptext as a string or false if entry not found
     */
    protected function helptextFetch()
    {
        try {
            $res = $this->_pdo->query('SELECT value FROM SystemGlobalSettings
					WHERE name="helptext"');
            return $res->fetchColumn();
        } catch (\PDOException $e) {
            $this->_logger->log('error fetching the helptext', 'Notice', Null, json_encode(array('msg' => $e->getMessage())));
            $this->_interface->dieError(_g('Could not fetch the helptext.'));
        }
    }
Beispiel #14
0
    private function classChange($userId, $classId, $newClassId, $newCategoryId)
    {
        try {
            $stmt = $this->_pdo->prepare('UPDATE KuwasysTemporaryRequestsAssign
				SET classId = :newClassId, categoryId = :newCategoryId
				WHERE userId = :userId AND classId = :classId');
            $stmt->execute(array('userId' => $userId, 'classId' => $classId, 'newClassId' => $newClassId, 'newCategoryId' => $newCategoryId));
        } catch (\PDOException $e) {
            die(json_encode(array('value' => 'error', 'message' => _g('Could not move the User to the other Class!'))));
        }
    }
Beispiel #15
0
    /**
     * Changes the Status of a Temporary Request Entry
     *
     * Dies with Json on Error
     */
    private function changeStatus($userId, $classId, $statusId)
    {
        try {
            $stmt = $this->_pdo->prepare('UPDATE KuwasysTemporaryRequestsAssign
				SET statusId = :statusId
				WHERE classId = :classId AND userId = :userId');
            $stmt->execute(array('statusId' => $statusId, 'classId' => $classId, 'userId' => $userId));
        } catch (PDOException $e) {
            die(json_encode(array('value' => 'error', 'message' => _g('Could not change the Status of the User'))));
        }
    }
Beispiel #16
0
 public function execute($dataContainer)
 {
     parent::entryPoint($dataContainer);
     try {
         $data = $this->temporaryAssignmentsRequestsOfClassGet($_POST['classId'], $_POST['categoryId']);
         $data = $this->requestsAtSameCategoryForRequestsAppend($data);
     } catch (PDOException $e) {
         $this->_logger->log('Error fetching the user-assignments', 'Notice', Null, json_encode(array('msg' => $e->getMessage())));
         die(json_encode(array('value' => 'error', 'message' => _g('Could not fetch the User-Assignments') . $e->getMessage())));
     }
     die(json_encode($data));
 }
Beispiel #17
0
    /**
     * Adds the temporary assignments to the jointUsersInClass-Table
     *
     * Dies displaying a Message on Error.
     * Only Entries with an StatusId that is not Zero will be added.
     */
    protected function newAssignmentsAddToJoints()
    {
        try {
            $this->_pdo->exec('INSERT INTO KuwasysUsersInClassesAndCategories
				(UserID, ClassID, statusId, categoryId)
				SELECT userId, classId, statusId, categoryId
					FROM KuwasysTemporaryRequestsAssign re
					WHERE statusId <> 0');
        } catch (PDOException $e) {
            $this->_interface->dieError(_g('Could not add the new Joints!') . $e->getMessage());
        }
    }
 /**
  * Looks the user for the given CardID up, checks if the Card is locked and returns the UserID
  * @param string $card_id The ID of the Card
  * @return string UserID
  */
 public function GetUser($card_id)
 {
     try {
         $uid = $this->cardManager->getUserID($card_id);
         if ($this->userManager->checkAccount($uid)) {
             $this->checkoutInterface->CardLocked();
         }
     } catch (Exception $e) {
         $this->checkoutInterface->dieError(_g('Could not find the User by Cardnumber %1$s', $card_id));
     }
     return $uid;
 }
Beispiel #19
0
    /**
     * Assigns the User to a Class
     *
     * @param  int    $userId   The ID of the User to assign
     * @param  int    $classId  The ID of the Class to assign the User to
     * @param  int    $statusId The ID of the Status
     * @throws PDOException If Things didnt work out
     */
    private function userAssignToClass($userId, $classId, $categoryId, $statusId)
    {
        try {
            $stmt = $this->_pdo->prepare('INSERT INTO KuwasysTemporaryRequestsAssign
				(userId, classId, categoryId, statusId, origUserId,
					origClassId, origCategoryId, origStatusId)
				VALUES
				(:userId, :classId, :categoryId, :statusId, 0, 0, 0, 0)');
            $stmt->execute(array('userId' => $userId, 'classId' => $classId, 'categoryId' => $categoryId, 'statusId' => $statusId));
        } catch (PDOException $e) {
            die(json_encode(array('value' => 'error', 'message' => _g('Could not add the User to the Class'))));
        }
    }
Beispiel #20
0
function _url($get, $pars = false)
{
    $g = array_merge($get);
    $route = _g($g, 'route', _g($g, '_route_', ''));
    unset($g['route']);
    $p = '';
    if (!empty($g)) {
        $p .= '&' . http_build_query($g);
    }
    if ($pars) {
        $p .= '&' . http_build_query($pars);
    }
    return $route . $p;
}
 /**
  * Method to get the field options.
  *
  * @return	array	The field option objects.
  * @since	1.6
  */
 protected function getOptions()
 {
     global $gantry;
     $options = array();
     $options = parent::getOptions();
     $link_cats = get_terms('link_category');
     $options[] = GantryHtmlSelect::option('', _g('All Links'), 'value', 'text', false);
     foreach ($link_cats as $link_cat) {
         // Create a new option object based on the <option /> element.
         $tmp = GantryHtmlSelect::option($link_cat->slug, $link_cat->name, 'value', 'text', false);
         $options[] = $tmp;
     }
     return $options;
 }
Beispiel #22
0
    function render($args, $instance)
    {
        global $gantry;
        $gantry->addScript('mootools.js');
        $gantry->addScript('gantry-totop.js');
        ob_start();
        ?>
			<a href="#" id="gantry-totop"><?php 
        echo _g($instance['text']);
        ?>
</a>
		<?php 
        echo ob_get_clean();
    }
Beispiel #23
0
 /**
  * Показываем дату с учетом сдвига времени
  *
  * @param int $var Время в Unix формате
  *
  * @return string
  */
 public static function displayDate($var)
 {
     //TODO: Исправить время сдвига
     $shift = (Config::$timeshift + App::user()->get()->config()->timeShift) * 3600;
     if (date('Y', $var) == date('Y', time())) {
         if (date('z', $var + $shift) == date('z', time() + $shift)) {
             return _g('Today') . ', ' . date("H:i", $var + $shift);
         }
         if (date('z', $var + $shift) == date('z', time() + $shift) - 1) {
             return _g('Yesterday') . ', ' . date("H:i", $var + $shift);
         }
     }
     return date("d.m.Y / H:i", $var + $shift);
 }
Beispiel #24
0
 /**
  * Tries to get the ID of given Schoolyearnames allowing to upload it
  *
  * Dies displaying a message on Error
  * Adds the pair 'ID' => <schoolyearId> to each array-Element
  */
 protected function schoolyearIdsAppendToColumns()
 {
     $schoolyears = $this->schoolyearsGetAll();
     foreach ($this->_contentArray as &$con) {
         if (!empty($con['schoolyear'])) {
             $id = $this->schoolyearIdGetByLabel($con['schoolyear'], $schoolyears);
             if ($id !== false) {
                 $con['schoolyearId'] = $id;
             } else {
                 $this->errorDie(_g('Could not find the Schoolyear "%1$s"', $con['schoolyear']));
             }
         }
     }
 }
Beispiel #25
0
 function detail()
 {
     $id = _g('id');
     $getProduk = $this->contentHelper->getArticle($id);
     if ($getProduk) {
         $content = unserialize($getProduk[0]['content']);
         $category = explode(',', $content['category']);
         $color = explode(',', $content['color']);
         $content['category'] = $category;
         $content['color'] = $color;
         $data = $getProduk[0];
         $data['data'] = $content;
     }
     // pr($data);
     $this->view->assign('paket', $data);
     return $this->loadView('paket/detail');
 }
Beispiel #26
0
    /**
     * Fetches all Classes that are in the active Schoolyear
     *
     * Dies displaying a Message on Error
     *
     * @return array  The Classes
     */
    private function classesGetAllOfActiveSchoolyear()
    {
        try {
            $classes = $this->_pdo->query('SELECT c.*, ca.translatedName AS categoryName,
					ca.ID AS categoryId
				FROM KuwasysClasses c
				INNER JOIN KuwasysClassesInCategories cic
					ON cic.classId = c.ID
				INNER JOIN KuwasysClassCategories ca
					ON ca.ID = cic.categoryId
				WHERE c.schoolyearId = @activeSchoolyear');
            return $classes;
        } catch (PDOException $e) {
            $this->_interface->dieError(_g('Could not fetch all classes of the active schoolyear'));
            $this->_logger->log('Error fetching all classes of the active ' . 'schoolyear', 'Notice', Null, json_encode(array('msg' => $e->getMessage())));
        }
    }
Beispiel #27
0
 public function pay()
 {
     $this->load->helper('multi_pay');
     if (!$this->customer->isLogged()) {
         $this->session->data['redirect'] = $this->url->link(_url($_GET), 'SSL');
         $this->redirect($this->url->link('account/login', '', 'SSL'));
     }
     $order_id = _g($_GET, 'order_id', _g($this->session->data, 'order_id'));
     if (!$order_id) {
         $this->redirect($this->url->link('account/order'));
     }
     $this->session->data['order_id'] = $order_id;
     // подтверждаем заказ (если он уже есть то там будет это проигнорировано)
     $this->load->model('payment/multi_pay_tools');
     $this->model_payment_multi_pay_tools->order_confirm($order_id, '');
     // просто перейдем на оплату разными способами для заказа
     $this->redirect($this->url->link('account/multi_pay/order', '&order_id=' . $order_id, 'SSL'));
 }
Beispiel #28
0
    /**
     * Returns the count of conflicts solved and still open
     * Dies displaying a message on error
     * @return array Two elements, one with open and one with solved conflicts
     */
    protected function conflictCountGet()
    {
        try {
            $res = $this->_pdo->query('SELECT (
					SELECT COUNT(*) FROM UserUpdateTempConflicts
					WHERE solved = 0
				) AS openConflicts,
				(
					SELECT COUNT(*) FROM UserUpdateTempConflicts
					WHERE solved = 1
				) AS solvedConflicts
			');
            return $res->fetch();
        } catch (\PDOException $e) {
            $this->_logger->log('Error fetching conflictcount', 'Notice', Null, json_encode(array('msg' => $e->getMessage())));
            $this->_interface->dieError(_g('Could not fetch the data!'));
        }
    }
Beispiel #29
0
    /**
     * Fetches the Temporary Assignments Grouped by Classes
     * @return array  The Classes and some more information
     */
    private function assignmentsGet()
    {
        try {
            $data = $this->_pdo->query('SELECT cu.translatedName AS weekday,
					COUNT(*) - (
						SELECT COUNT(*) FROM KuwasysTemporaryRequestsAssign rad
						WHERE ra.classId = rad.classId AND (rad.statusId = 0 OR rad.statusId = 2)
					) AS usercount, c.label AS classlabel,
					c.ID AS classId, ra.categoryId AS categoryId
				FROM KuwasysTemporaryRequestsAssign ra
				INNER JOIN KuwasysClasses c ON ra.classId = c.ID
				INNER JOIN KuwasysClassCategories cu ON cu.ID = ra.categoryId
				GROUP BY ra.classId, ra.categoryId
				ORDER BY usercount DESC, ra.classId');
            return $data;
        } catch (PDOException $e) {
            $this->_interface->dieError(_g('Could not fetch the Temporary Assignments!'));
        }
    }
Beispiel #30
0
    function render($args, $instance)
    {
        global $gantry;
        ob_start();
        ?>
		<div class="clear"></div>
		<span  id="gantry-resetsettings">
            [ <a href="<?php 
        echo $gantry->addQueryStringParams($gantry->getCurrentUrl($gantry->_setbyurl), array('reset-settings' => ''));
        ?>
"><?php 
        echo _g($instance['text']);
        ?>
</a> ]
		</span>
		<div class="clear"></div>
	    <?php 
        echo ob_get_clean();
    }