예제 #1
0
파일: service.php 프로젝트: vazahat/dudex
 public static function getInstance()
 {
     if (self::$classInstance === null) {
         self::$classInstance = new self();
     }
     return self::$classInstance;
 }
예제 #2
0
파일: init.php 프로젝트: vazahat/dudex
function profileprogressbar_delete_item(OW_Event $event)
{
    $params = $event->getParams();
    if (!in_array($params['entityType'], PROFILEPROGRESSBAR_BOL_Service::getEntityTypes()) || empty($params['entityId'])) {
        return;
    }
    $log = PROFILEPROGRESSBAR_BOL_ActivityLogDao::getInstance()->findCompletedLog($params['entityType'], $params['entityId']);
    if (!empty($log) && $log->userId == OW::getUser()->getId()) {
        PROFILEPROGRESSBAR_BOL_ActivityLogDao::getInstance()->deleteById($log->id);
    }
}
예제 #3
0
파일: admin.php 프로젝트: vazahat/dudex
 public function features(array $params = array())
 {
     $this->document->addStyleSheet($this->plugin->getStaticCssUrl() . 'ui' . DS . 'jquery-ui-1.10.3.custom.min.css');
     $this->document->addScript($this->plugin->getStaticJsUrl() . 'jquery-ui.custom.min.js');
     $config = OW::getConfig();
     if (OW::getRequest()->isPost() && !empty($_POST['features'])) {
         $config->saveConfig('profileprogressbar', 'features', json_encode(array_map('intval', $_POST['features'])));
         $config->saveConfig('profileprogressbar', 'per_day', (int) $_POST['interval']);
     }
     $this->assign('perDay', $config->getValue('profileprogressbar', 'per_day'));
     $this->assign('features', get_object_vars(json_decode($config->getValue('profileprogressbar', 'features'))));
     $this->assign('availableFeatures', PROFILEPROGRESSBAR_BOL_Service::getInstance()->getAvailableFeatures());
 }
예제 #4
0
파일: hint.php 프로젝트: vazahat/dudex
    public function __construct($userId)
    {
        if (empty($userId)) {
            $this->setVisible(FALSE);
            return;
        }
        $data = PROFILEPROGRESSBAR_BOL_Service::getInstance()->getProgressbarData($userId);
        OW::getDocument()->addOnloadScript(UTIL_JsGenerator::composeJsString(';var progressbar = $("#profile-progressbar-{$userId}");
                var complete = {$complete};

                progressbar.find(".profile-progressbar-caption").text(complete + "%");
                progressbar.find(".profile-progressbar-complete").animate({width: complete + "%"}, 
                {
                    duration: "slow",
                    specialEasing: {width: "easeOutBounce"},
                    queue: false
                });', array('userId' => (int) $userId, 'complete' => round($data[PROFILEPROGRESSBAR_BOL_Service::KEY_PROGRESSBAR][PROFILEPROGRESSBAR_BOL_Service::COUNT_COMPLETED_QUESTION] * 100 / $data[PROFILEPROGRESSBAR_BOL_Service::KEY_PROGRESSBAR][PROFILEPROGRESSBAR_BOL_Service::COUNT_QUESTION]))));
        $this->assign('userId', $userId);
    }
예제 #5
0
파일: widget.php 프로젝트: vazahat/dudex
 public function __construct(BASE_CLASS_WidgetParameter $paramObj)
 {
     parent::__construct();
     $theme = OW::getConfig()->getValue('profileprogressbar', 'theme');
     OW::getDocument()->addStyleSheet(OW::getPluginManager()->getPlugin('profileprogressbar')->getStaticCssUrl() . $theme . '.css');
     $data = PROFILEPROGRESSBAR_BOL_Service::getInstance()->getProgressbarData($paramObj->additionalParamList['entityId'], (bool) OW::getConfig()->getValue('profileprogressbar', 'show_hint') && $paramObj->additionalParamList['entityId'] == OW::getUser()->getId());
     if (empty($data)) {
         $this->setVisible(FALSE);
     }
     $percent = round($data[PROFILEPROGRESSBAR_BOL_Service::KEY_PROGRESSBAR][PROFILEPROGRESSBAR_BOL_Service::COUNT_COMPLETED_QUESTION] * 100 / $data[PROFILEPROGRESSBAR_BOL_Service::KEY_PROGRESSBAR][PROFILEPROGRESSBAR_BOL_Service::COUNT_QUESTION]);
     $this->assign('percent', $percent > 100 ? 100 : $percent);
     if (!empty($data[PROFILEPROGRESSBAR_BOL_Service::KEY_HINT])) {
         $document = OW::getDocument();
         $plugin = OW::getPluginManager()->getPlugin('profileprogressbar');
         $document->addStyleSheet($plugin->getStaticCssUrl() . 'tipTip.css');
         $document->addScript($plugin->getStaticJsUrl() . 'jquery.tipTip.minified.js');
         $document->addOnloadScript(UTIL_JsGenerator::composeJsString(';$("#profile_progressbar").tipTip({
                     maxWidth: "auto",
                     content: {$hint}
                 });', array('hint' => $data[PROFILEPROGRESSBAR_BOL_Service::KEY_HINT])));
     }
 }
예제 #6
0
 public function onBeforeRender()
 {
     parent::onBeforeRender();
     $document = OW::getDocument();
     $plugin = OW::getPluginManager()->getPlugin('profileprogressbar');
     $theme = OW::getConfig()->getValue('profileprogressbar', 'theme');
     $document->addStyleSheet($plugin->getStaticCssUrl() . $theme . '.css');
     $document->addScript($plugin->getStaticJsUrl() . 'jquery-ui.custom.min.js');
     $document->addScript($plugin->getStaticJsUrl() . 'profile_progressbar.js');
     $data = PROFILEPROGRESSBAR_BOL_Service::getInstance()->getProgressbarData(OW::getUser()->getId(), (bool) OW::getConfig()->getValue('profileprogressbar', 'show_hint'));
     OW::getDocument()->addScriptDeclarationBeforeIncludes(UTIL_JsGenerator::composeJsString(';window.PROFILEPROGRESSBARPARAMS = {
                 totalQuestionCount: {$totalQuestionCount},
                 completeQuestionCount: {$completeQuestionCount}
             };', $data[PROFILEPROGRESSBAR_BOL_Service::KEY_PROGRESSBAR]));
     if (!empty($data[PROFILEPROGRESSBAR_BOL_Service::KEY_HINT])) {
         $document->addStyleSheet($plugin->getStaticCssUrl() . 'tipTip.css');
         $document->addScript($plugin->getStaticJsUrl() . 'jquery.tipTip.minified.js');
         $document->addOnloadScript('$("#profile-progressbar").tipTip({
             maxWidth: "auto",
             content: "' . $data[PROFILEPROGRESSBAR_BOL_Service::KEY_HINT] . '"
             });');
     }
 }