Esempio n. 1
1
/**
 * Handle the question deletion from the question pool page.
 * @param PageBuilder $page The page rendering object.
 */
function WPCW_quizzes_handleQuestionDeletion($page)
{
    global $wpcwdb, $wpdb;
    $wpdb->show_errors();
    // Check that the question exists and deletion has been requested
    if (isset($_GET['action']) && $_GET['action'] == 'delete' && isset($_GET['question_id'])) {
        $questionID = $_GET['question_id'];
        $questionDetails = WPCW_questions_getQuestionDetails($questionID);
        // Only do deletion if question details are valid.
        if ($questionDetails) {
            // Get tags for questions
            $question_tags = WPCW_questions_getQuestionDetails($questionID, $getTagsToo = true);
            // Remove tags for each question
            foreach ($question_tags->tags as $question_tag) {
                WPCW_questions_tags_removeTag($questionID, $question_tag->question_tag_id);
            }
            // Delete question from question map
            $wpdb->query($wpdb->prepare("\n\t\t\t\tDELETE FROM {$wpcwdb->quiz_qs_mapping}\n\t\t\t\tWHERE question_id = %d\n\t\t\t", $questionDetails->question_id));
            // Finally delete question itself
            $wpdb->query($wpdb->prepare("\n\t\t\t\tDELETE FROM {$wpcwdb->quiz_qs} \n\t\t\t\tWHERE question_id = %d\n\t\t\t", $questionDetails->question_id));
            $page->showMessage(sprintf(__('The question \'%s\' was successfully deleted.', 'wp_courseware'), $questionDetails->question_question));
        }
        // end of if $questionDetails
    }
    // end of check for deletion action
}
Esempio n. 2
0
 private function buildpage()
 {
     $pagebuilder = new PageBuilder($this->page);
     //expect a file location from pagebuilder.
     return $pagebuilder->build($this->site, true);
     //build the page, and set return filepath to true in order to get the filepath not html
 }
Esempio n. 3
0
/**
 * Shows the documentation page for the plugin. 
 */
function WPCW_showPage_Documentation_load()
{
    $page = new PageBuilder();
    // List of tabs to show
    $docTabs = array('default' => array('flag' => false, 'fn' => 'WPCW_showPage_Documentation_shortcodes', 'label' => __('Shortcodes', 'wp_courseware')), 'howto' => array('flag' => 'howto', 'fn' => 'WPCW_showPage_Documentation_howto', 'label' => __('How-To Videos', 'wp_courseware')));
    // Allow modification of the documentation tabs.
    $docTabs = apply_filters('wpcw_back_documentation_tabs', $docTabs);
    printf('<div class="wrap">');
    $tabNames = array_keys($docTabs);
    // What tabs are active?
    $tabSel = WPCW_arrays_getValue($_GET, 'info');
    if (!in_array($tabSel, $tabNames)) {
        $tabSel = false;
    }
    // Create main settings tab URL
    $baseURL = admin_url('admin.php?page=WPCW_showPage_Documentation');
    // Header
    printf('<h2 class="nav-tab-wrapper">');
    // Icon
    printf('<div id="icon-pagebuilder" class="icon32" style="background-image: url(\'%s\'); margin: 0px 6px 0 6px;"><br></div>', WPCW_icon_getPageIconURL());
    foreach ($docTabs as $type => $tabDetails) {
        // Tabs
        $urlToUse = $baseURL;
        if ($tabDetails['flag']) {
            $urlToUse = $baseURL . '&info=' . $tabDetails['flag'];
        }
        printf('<a href="%s" class="nav-tab %s">%s</a>', $urlToUse, $tabDetails['flag'] == $tabSel ? 'nav-tab-active' : '', $tabDetails['label']);
    }
    printf('</h2>');
    // Create the doc header.
    $page->showPageHeader(false, '75%', false, true);
    // What settings do we show?
    if (in_array($tabSel, $tabNames)) {
        call_user_func($docTabs[$tabSel]['fn']);
    } else {
        call_user_func($docTabs['default']['fn']);
    }
    // Needed to show RHS section for panels
    $page->showPageMiddle('23%');
    // RHS Support Information
    WPCW_docs_showSupportInfo($page);
    WPCW_docs_showSupportInfo_News($page);
    WPCW_docs_showSupportInfo_Affiliate($page);
    $page->showPageFooter();
    // Final div closed by showPageFooter().
    //printf('</div>');
}
/**
 * Shows the settings page for the plugin, shown just for the network page.
 */
function WPCW_showPage_Settings_Network_load()
{
    $page = new PageBuilder(true);
    $page->showPageHeader(__('WP Courseware - Settings', 'wp_courseware'), '75%', WPCW_icon_getPageIconURL());
    $settingsFields = array('section_access_key' => array('type' => 'break', 'html' => WPCW_forms_createBreakHTML(__('Licence Key Settings', 'wp_courseware'), false, true)), 'licence_key' => array('label' => __('Licence Key', 'wp_courseware'), 'type' => 'text', 'desc' => __('Your licence key for the WP Courseware plugin.', 'wp_courseware'), 'validate' => array('type' => 'string', 'maxlen' => 32, 'minlen' => 32, 'regexp' => '/^[A-Za-z0-9]+$/', 'error' => __('Please enter your 32 character licence key, which contains only letters and numbers.', 'wp_courseware'))));
    $settings = new SettingsForm($settingsFields, WPCW_DATABASE_SETTINGS_KEY, 'wpcw_form_settings_general');
    // Set strings and messages
    $settings->setAllTranslationStrings(WPCW_forms_getTranslationStrings());
    $settings->setSaveButtonLabel('Save ALL Settings', 'wp_courseware');
    // Form event handlers - processes the saved settings in some way
    $settings->afterSaveFunction = 'WPCW_showPage_Settings_afterSave';
    $settings->show();
    // RHS Support Information
    $page->showPageMiddle('23%');
    WPCW_docs_showSupportInfo($page);
    WPCW_docs_showSupportInfo_News($page);
    WPCW_docs_showSupportInfo_Affiliate($page);
    $page->showPageFooter();
}
Esempio n. 5
0
 protected function postProcessImpl(PageParams $pageParams, \RequestArrayAdapter $requestParams)
 {
     $SMARTY_PARAMS['JS_DEFS'] = PageBuilder::inst()->buildJsDefs($pageParams);
     $SMARTY_PARAMS_PAGE = $pageParams->getSmartyParams4Resources();
     $SMARTY_PARAMS = array_merge($SMARTY_PARAMS, $SMARTY_PARAMS_PAGE);
     $resources = PSSmarty::template('page/environment/wordpress/wp_page_resources_footer.tpl', $SMARTY_PARAMS)->fetch();
     $resources = trim($resources);
     $this->LOGGER->infoBox('PAGE_RESOURCES_FOOTER', $resources);
     echo PsHtml::div(array(), $resources);
 }
Esempio n. 6
0
 /**
  * Список фолдингов
  */
 public static function listFoldings()
 {
     $managers = array(MagManager::inst(), BlogManager::inst(), TrainManager::inst());
     $foldings = array();
     foreach ($managers as $manager) {
         if ($manager instanceof RubricsProcessor) {
             $foldings[] = $manager->getRubricsFolding();
         }
         if ($manager instanceof PostsProcessor) {
             $foldings[] = $manager->getFolding();
         }
     }
     //Фолдинги
     $foldings[] = PopupPagesManager::inst();
     $foldings[] = PluginsManager::inst();
     $foldings[] = IdentPagesManager::inst();
     $foldings[] = TimeLineManager::inst();
     $foldings[] = TemplateMessages::inst();
     $foldings[] = UserPointsManager::inst();
     $foldings[] = StockManager::inst();
     $foldings[] = HelpManager::inst();
     $foldings[] = EmailManager::inst();
     $foldings[] = PSForm::inst();
     $foldings[] = DialogManager::inst();
     //Библиотеки
     $foldings[] = PoetsManager::inst();
     $foldings[] = ScientistsManager::inst();
     //Админские страницы
     $foldings[] = APagesResources::inst();
     //Базовые страницы
     $foldings[] = BasicPagesManager::inst();
     //Построитель страниц
     $foldings[] = PageBuilder::inst();
     //Управление списком предпросмотра постов
     $foldings[] = ShowcasesCtrlManager::inst();
     //Элементы в правой панели навигации
     $foldings[] = ClientBoxManager::inst();
     //Все фолдинги системы
     return $foldings;
 }
/**
 * Show the page where the user can set up the certificate settings. 
 */
function WPCW_showPage_Certificates_load()
{
    $page = new PageBuilder(true);
    $page->showPageHeader(__('Training Courses - Certificate Settings', 'wp_courseware'), '75%', WPCW_icon_getPageIconURL());
    $settingsFields = array('section_certificates_defaults' => array('type' => 'break', 'html' => WPCW_forms_createBreakHTML(__('Certificate Settings', 'wp_courseware'))), 'cert_signature_type' => array('label' => __('Signature Type', 'wp_courseware'), 'type' => 'radio', 'cssclass' => 'wpcw_cert_signature_type', 'required' => 'true', 'data' => array('text' => sprintf('<b>%s</b> - %s', __('Text', 'wp_courseware'), __('Just use text for the signature.', 'wp_courseware')), 'image' => sprintf('<b>%s</b> - %s', __('Image File', 'wp_courseware'), __('Use an image for the signature.', 'wp_courseware')))), 'cert_sig_text' => array('label' => __('Name to use for signature', 'wp_courseware'), 'type' => 'text', 'cssclass' => 'wpcw_cert_signature_type_text', 'desc' => __('The name to use for the signature area.', 'wp_courseware'), 'validate' => array('type' => 'string', 'maxlen' => 150, 'minlen' => 1, 'regexp' => '/^[^<>]+$/', 'error' => __('Please enter the name to use for the signature area.', 'wp_courseware'))), 'cert_sig_image_url' => array('label' => __('Your Signature Image', 'wp_courseware'), 'cssclass' => 'wpcw_image_upload_field wpcw_cert_signature_type_image', 'type' => 'text', 'desc' => '&bull;&nbsp;' . __('The URL of your signature image. Using a transparent image is recommended.', 'wp_courseware') . '<br/>&bull;&nbsp;' . sprintf(__('The image must be <b>%d pixels wide, and %d pixels high</b> to render correctly. ', 'wp_courseware'), WPCW_CERTIFICATE_SIGNATURE_WIDTH_PX * 2, WPCW_CERTIFICATE_SIGNATURE_HEIGHT_PX * 2), 'validate' => array('type' => 'url', 'maxlen' => 300, 'minlen' => 1, 'error' => __('Please enter the URL of your signature image.', 'wp_courseware')), 'extrahtml' => sprintf('<a id="cert_sig_image_url_btn" href="#" class="wpcw_insert_image button-secondary" data-uploader_title="%s" data-uploader_btn_text="%s" data-target="cert_sig_image_url"><span class="wpcw_insert_image_img"></span> %s</a>', __('Choose an image to use for the signature image...', 'wp_courseware'), __('Select Image', 'wp_courseware'), __('Select Image', 'wp_courseware'))), 'cert_logo_enabled' => array('label' => __('Show your logo?', 'wp_courseware'), 'cssclass' => 'wpcw_cert_logo_enabled', 'type' => 'radio', 'required' => 'true', 'data' => array('cert_logo' => sprintf('<b>%s</b> - %s', __('Yes', 'wp_courseware'), __('Use your logo on the certificate.', 'wp_courseware')), 'no_cert_logo' => sprintf('<b>%s</b> - %s', __('No', 'wp_courseware'), __('Don\'t show a logo on the certificate.', 'wp_courseware')))), 'cert_logo_url' => array('label' => __('Your Logo Image', 'wp_courseware'), 'type' => 'text', 'cssclass' => 'wpcw_cert_logo_url wpcw_image_upload_field', 'desc' => '&bull;&nbsp;' . __('The URL of your logo image. Using a transparent image is recommended.', 'wp_courseware') . '<br/>&bull;&nbsp;' . sprintf(__('The image must be <b>%d pixels wide, and %d pixels</b> high to render correctly. ', 'wp_courseware'), WPCW_CERTIFICATE_LOGO_WIDTH_PX * 2, WPCW_CERTIFICATE_LOGO_HEIGHT_PX * 2), 'validate' => array('type' => 'url', 'maxlen' => 300, 'minlen' => 1, 'error' => __('Please enter the URL of your logo image.', 'wp_courseware')), 'extrahtml' => sprintf('<a id="cert_logo_url_btn" href="#" class="wpcw_insert_image button-secondary" data-uploader_title="%s" data-uploader_btn_text="%s" data-target="cert_logo_url"><span class="wpcw_insert_image_img"></span> %s</a>', __('Choose an image to use for your logo on the certificate...', 'wp_courseware'), __('Select Image', 'wp_courseware'), __('Select Image', 'wp_courseware'))), 'cert_background_type' => array('label' => __('Certificate Background', 'wp_courseware'), 'cssclass' => 'wpcw_cert_background_type', 'type' => 'radio', 'required' => 'true', 'data' => array('use_default' => sprintf('<b>%s</b> - %s', __('Built-in', 'wp_courseware'), __('Use the built-in certificate background.', 'wp_courseware')), 'use_custom' => sprintf('<b>%s</b> - %s', __('Custom', 'wp_courseware'), __('Use your own certificate background.', 'wp_courseware')))), 'cert_background_custom_url' => array('label' => __('Custom Background Image', 'wp_courseware'), 'type' => 'text', 'cssclass' => 'wpcw_cert_background_custom_url wpcw_image_upload_field', 'desc' => '&bull;&nbsp;' . __('The URL of your background image.', 'wp_courseware') . '<br/>&bull;&nbsp;' . sprintf(__('The background image must be <b>%d pixels wide, and %d pixels</b> high at <b>72 dpi</b> to render correctly. ', 'wp_courseware'), WPCW_CERTIFICATE_BG_WIDTH_PX, WPCW_CERTIFICATE_BG_HEIGHT_PX), 'validate' => array('type' => 'url', 'maxlen' => 300, 'minlen' => 1, 'error' => __('Please enter the URL of your certificate background image.', 'wp_courseware')), 'extrahtml' => sprintf('<a id="cert_background_custom_url_btn" href="#" class="wpcw_insert_image button-secondary" data-uploader_title="%s" data-uploader_btn_text="%s" data-target="cert_background_custom_url"><span class="wpcw_insert_image_img"></span> %s</a>', __('Choose an image to use for the certificate background...', 'wp_courseware'), __('Select Image', 'wp_courseware'), __('Select Image', 'wp_courseware'))), 'section_encodings' => array('type' => 'break', 'html' => WPCW_forms_createBreakHTML(__('Language and Encoding Settings', 'wp_courseware'))), 'certificate_encoding' => array('label' => __('Certificate Encoding', 'wp_courseware'), 'type' => 'select', 'required' => true, 'desc' => __('Choose a codepage encoding that matches your language to ensure certificates render correctly. You may need an encoding other than <code>ISO-8859-1</code> if you are using a non-English language.', 'wp_courseware'), 'data' => array('ISO-8859-1' => __('ISO-8859-1 - Latin alphabet - North America, Western Europe, Latin America, etc. (Default)', 'wp_courseware'), 'ISO-8859-2' => __('ISO-8859-2 - Latin alphabet 2 - Eastern Europe.', 'wp_courseware'), 'ISO-8859-3' => __('ISO-8859-3 - Latin alphabet 3 - SE Europe, Esperanto', 'wp_courseware'), 'ISO-8859-4' => __('ISO-8859-4 - Latin alphabet 4 - Scandinavia/Baltics', 'wp_courseware'), 'ISO-8859-5' => __('ISO-8859-5 - Latin/Cyrillic - Bulgarian, Belarusian, Russian and Macedonian', 'wp_courseware'), 'ISO-8859-6' => __('ISO-8859-6 - Latin/Arabic - Arabic languages', 'wp_courseware'), 'ISO-8859-7' => __('ISO-8859-7 - Latin/Greek - modern Greek language', 'wp_courseware'), 'ISO-8859-8' => __('ISO-8859-8 - Latin/Hebrew - Hebrew languages', 'wp_courseware'), 'ISO-8859-9' => __('ISO-8859-9 - Latin 5 part 9 - Turkish languages', 'wp_courseware'), 'ISO-8859-10' => __('ISO-8859-10 - Latin 6 Lappish, Nordic, Eskimo - The Nordic languages', 'wp_courseware'), 'ISO-8859-15' => __('ISO-8859-15 - Latin 9 (aka Latin 0) - Similar to ISO 8859-1', 'wp_courseware'))));
    $settings = new SettingsForm($settingsFields, WPCW_DATABASE_SETTINGS_KEY, 'wpcw_form_settings_certificates');
    $settings->setSaveButtonLabel(__('Save ALL Settings', 'wp_courseware'));
    $settings->msg_settingsSaved = __('Settings successfully saved.', 'wp_courseware');
    $settings->msg_settingsProblem = __('There was a problem saving the settings.', 'wp_courseware');
    $settings->setAllTranslationStrings(WPCW_forms_getTranslationStrings());
    $settings->show();
    // RHS Support Information
    $page->showPageMiddle('23%');
    // Create a box where the admin can preview the certificates to see what they look like.
    $page->openPane('wpcw-certificates-preview', __('Preview Certificate', 'wp_courseware'));
    printf('<p>%s</p>', __('After saving the settings, you can preview the certificate using the button below. The preview opens in a new window.', 'wp_courseware'));
    printf('<div class="wpcw_btn_centre"><a href="%spdf_create_certificate.php?certificate=preview" target="_blank" class="button-primary">%s</a></div>', WPCW_plugin_getPluginPath(), __('Preview Certificate', 'wp_courseware'));
    $page->closePane();
    WPCW_docs_showSupportInfo($page);
    WPCW_docs_showSupportInfo_News($page);
    WPCW_docs_showSupportInfo_Affiliate($page);
    $page->showPageFooter();
}
/**
 * Show the page where the user can set up the certificate settings. 
 */
function WPCW_showPage_Certificates_load()
{
    $page = new PageBuilder(true);
    $page->showPageHeader(__('Training Courses - Certificate Settings', 'wp_courseware'), '75%', WPCW_icon_getPageIconURL());
    $settingsFields = array('section_certificates_defaults' => array('type' => 'break', 'html' => WPCW_forms_createBreakHTML(__('Certificate Settings', 'wp_courseware'))), 'cert_signature_type' => array('label' => __('Signature Type', 'wp_courseware'), 'type' => 'radio', 'cssclass' => 'wpcw_cert_signature_type', 'required' => 'true', 'data' => array('text' => sprintf('<b>%s</b> - %s', __('Text', 'wp_courseware'), __('Just use text for the signature.', 'wp_courseware')), 'image' => sprintf('<b>%s</b> - %s', __('Image File', 'wp_courseware'), __('Use an image for the signature.', 'wp_courseware')))), 'cert_sig_text' => array('label' => __('Name to use for signature', 'wp_courseware'), 'type' => 'text', 'cssclass' => 'wpcw_cert_signature_type_text', 'desc' => __('The name to use for the signature area.', 'wp_courseware'), 'validate' => array('type' => 'string', 'maxlen' => 150, 'minlen' => 1, 'regexp' => '/^[^<>]+$/', 'error' => __('Please enter the name to use for the signature area.', 'wp_courseware'))), 'cert_sig_image_url' => array('label' => __('Your Signature Image', 'wp_courseware'), 'cssclass' => 'wpcw_image_upload_field wpcw_cert_signature_type_image', 'type' => 'text', 'desc' => '&bull;&nbsp;' . __('The URL of your signature image. Using a transparent image is recommended.', 'wp_courseware') . '<br/>&bull;&nbsp;' . sprintf(__('The image must be <b>%d pixels wide, and %d pixels high</b> to render correctly. ', 'wp_courseware'), WPCW_CERTIFICATE_SIGNATURE_WIDTH_PX * 2, WPCW_CERTIFICATE_SIGNATURE_HEIGHT_PX * 2), 'validate' => array('type' => 'url', 'maxlen' => 300, 'minlen' => 1, 'error' => __('Please enter the URL of your signature image.', 'wp_courseware')), 'extrahtml' => sprintf('<a id="cert_sig_image_url_btn" href="#" class="wpcw_insert_image button-secondary" data-uploader_title="%s" data-uploader_btn_text="%s" data-target="cert_sig_image_url"><span class="wpcw_insert_image_img"></span> %s</a>', __('Choose an image to use for the signature image...', 'wp_courseware'), __('Select Image', 'wp_courseware'), __('Select Image', 'wp_courseware'))), 'cert_logo_enabled' => array('label' => __('Show your logo?', 'wp_courseware'), 'cssclass' => 'wpcw_cert_logo_enabled', 'type' => 'radio', 'required' => 'true', 'data' => array('cert_logo' => sprintf('<b>%s</b> - %s', __('Yes', 'wp_courseware'), __('Use your logo on the certificate.', 'wp_courseware')), 'no_cert_logo' => sprintf('<b>%s</b> - %s', __('No', 'wp_courseware'), __('Don\'t show a logo on the certificate.', 'wp_courseware')))), 'cert_logo_url' => array('label' => __('Your Logo Image', 'wp_courseware'), 'type' => 'text', 'cssclass' => 'wpcw_cert_logo_url wpcw_image_upload_field', 'desc' => '&bull;&nbsp;' . __('The URL of your logo image. Using a transparent image is recommended.', 'wp_courseware') . '<br/>&bull;&nbsp;' . sprintf(__('The image must be <b>%d pixels wide, and %d pixels</b> high to render correctly. ', 'wp_courseware'), WPCW_CERTIFICATE_LOGO_WIDTH_PX * 2, WPCW_CERTIFICATE_LOGO_HEIGHT_PX * 2), 'validate' => array('type' => 'url', 'maxlen' => 300, 'minlen' => 1, 'error' => __('Please enter the URL of your logo image.', 'wp_courseware')), 'extrahtml' => sprintf('<a id="cert_logo_url_btn" href="#" class="wpcw_insert_image button-secondary" data-uploader_title="%s" data-uploader_btn_text="%s" data-target="cert_logo_url"><span class="wpcw_insert_image_img"></span> %s</a>', __('Choose an image to use for your logo on the certificate...', 'wp_courseware'), __('Select Image', 'wp_courseware'), __('Select Image', 'wp_courseware'))), 'cert_background_type' => array('label' => __('Certificate Background', 'wp_courseware'), 'cssclass' => 'wpcw_cert_background_type', 'type' => 'radio', 'required' => 'true', 'data' => array('use_default' => sprintf('<b>%s</b> - %s', __('Built-in', 'wp_courseware'), __('Use the built-in certificate background.', 'wp_courseware')), 'use_custom' => sprintf('<b>%s</b> - %s', __('Custom', 'wp_courseware'), __('Use your own certificate background.', 'wp_courseware')))), 'cert_background_custom_url' => array('label' => __('Custom Background Image', 'wp_courseware'), 'type' => 'text', 'cssclass' => 'wpcw_cert_background_custom_url wpcw_image_upload_field', 'desc' => '&bull;&nbsp;' . __('The URL of your background image.', 'wp_courseware') . '<br/>&bull;&nbsp;' . sprintf(__('The background image must be <b>%d pixels wide, and %d pixels</b> high at <b>72 dpi</b> to render correctly. ', 'wp_courseware'), WPCW_CERTIFICATE_BG_WIDTH_PX, WPCW_CERTIFICATE_BG_HEIGHT_PX), 'validate' => array('type' => 'url', 'maxlen' => 300, 'minlen' => 1, 'error' => __('Please enter the URL of your certificate background image.', 'wp_courseware')), 'extrahtml' => sprintf('<a id="cert_background_custom_url_btn" href="#" class="wpcw_insert_image button-secondary" data-uploader_title="%s" data-uploader_btn_text="%s" data-target="cert_background_custom_url"><span class="wpcw_insert_image_img"></span> %s</a>', __('Choose an image to use for the certificate background...', 'wp_courseware'), __('Select Image', 'wp_courseware'), __('Select Image', 'wp_courseware'))));
    $settings = new SettingsForm($settingsFields, WPCW_DATABASE_SETTINGS_KEY, 'wpcw_form_settings_certificates');
    $settings->setSaveButtonLabel(__('Save ALL Settings', 'wp_courseware'));
    $settings->msg_settingsSaved = __('Settings successfully saved.', 'wp_courseware');
    $settings->msg_settingsProblem = __('There was a problem saving the settings.', 'wp_courseware');
    $settings->setAllTranslationStrings(WPCW_forms_getTranslationStrings());
    $settings->show();
    // RHS Support Information
    $page->showPageMiddle('23%');
    // Create a box where the admin can preview the certificates to see what they look like.
    $page->openPane('wpcw-certificates-preview', __('Preview Certificate', 'wp_courseware'));
    printf('<p>%s</p>', __('After saving the settings, you can preview the certificate using the button below. The preview opens in a new window.', 'wp_courseware'));
    printf('<div class="wpcw_btn_centre"><a href="%spdf_create_certificate.php?certificate=preview" target="_blank" class="button-primary">%s</a></div>', WPCW_plugin_getPluginPath(), __('Preview Certificate', 'wp_courseware'));
    $page->closePane();
    WPCW_docs_showSupportInfo($page);
    WPCW_docs_showSupportInfo_News($page);
    WPCW_docs_showSupportInfo_Affiliate($page);
    $page->showPageFooter();
}
Esempio n. 9
0
function install()
{
    // On free.fr host, make sure the /sessions directory exists, otherwise login will not work.
    if (endsWith($_SERVER['HTTP_HOST'], '.free.fr') && !is_dir($_SERVER['DOCUMENT_ROOT'] . '/sessions')) {
        mkdir($_SERVER['DOCUMENT_ROOT'] . '/sessions', 0705);
    }
    // This part makes sure sessions works correctly.
    // (Because on some hosts, session.save_path may not be set correctly,
    // or we may not have write access to it.)
    if (isset($_GET['test_session']) && (!isset($_SESSION) || !isset($_SESSION['session_tested']) || $_SESSION['session_tested'] != 'Working')) {
        // Step 2: Check if data in session is correct.
        echo '<pre>Sessions do not seem to work correctly on your server.<br>';
        echo 'Make sure the variable session.save_path is set correctly in your php config, and that you have write access to it.<br>';
        echo 'It currently points to ' . session_save_path() . '<br>';
        echo 'Check that the hostname used to access Shaarli contains a dot. On some browsers, accessing your server via a hostname like \'localhost\' or any custom hostname without a dot causes cookie storage to fail. We recommend accessing your server via it\'s IP address or Fully Qualified Domain Name.<br>';
        echo '<br><a href="?">Click to try again.</a></pre>';
        die;
    }
    if (!isset($_SESSION['session_tested'])) {
        // Step 1 : Try to store data in session and reload page.
        $_SESSION['session_tested'] = 'Working';
        // Try to set a variable in session.
        header('Location: ' . index_url($_SERVER) . '?test_session');
        // Redirect to check stored data.
    }
    if (isset($_GET['test_session'])) {
        // Step 3: Sessions are OK. Remove test parameter from URL.
        header('Location: ' . index_url($_SERVER));
    }
    if (!empty($_POST['setlogin']) && !empty($_POST['setpassword'])) {
        $tz = 'UTC';
        if (!empty($_POST['continent']) && !empty($_POST['city']) && isTimeZoneValid($_POST['continent'], $_POST['city'])) {
            $tz = $_POST['continent'] . '/' . $_POST['city'];
        }
        $GLOBALS['timezone'] = $tz;
        // Everything is ok, let's create config file.
        $GLOBALS['login'] = $_POST['setlogin'];
        $GLOBALS['salt'] = sha1(uniqid('', true) . '_' . mt_rand());
        // Salt renders rainbow-tables attacks useless.
        $GLOBALS['hash'] = sha1($_POST['setpassword'] . $GLOBALS['login'] . $GLOBALS['salt']);
        $GLOBALS['title'] = empty($_POST['title']) ? 'Shared links on ' . escape(index_url($_SERVER)) : $_POST['title'];
        $GLOBALS['config']['ENABLE_UPDATECHECK'] = !empty($_POST['updateCheck']);
        try {
            writeConfig($GLOBALS, isLoggedIn());
        } catch (Exception $e) {
            error_log('ERROR while writing config file after installation.' . PHP_EOL . $e->getMessage());
            // TODO: do not handle exceptions/errors in JS.
            echo '<script>alert("' . $e->getMessage() . '");document.location=\'?\';</script>';
            exit;
        }
        echo '<script>alert("Shaarli is now configured. Please enter your login/password and start shaaring your links!");document.location=\'?do=login\';</script>';
        exit;
    }
    // Display config form:
    list($timezone_form, $timezone_js) = generateTimeZoneForm();
    $timezone_html = '';
    if ($timezone_form != '') {
        $timezone_html = '<tr><td><b>Timezone:</b></td><td>' . $timezone_form . '</td></tr>';
    }
    $PAGE = new PageBuilder();
    $PAGE->assign('timezone_html', $timezone_html);
    $PAGE->assign('timezone_js', $timezone_js);
    $PAGE->renderPage('install');
    exit;
}
Esempio n. 10
0
/**
 * Function that show a summary of the training courses.
 */
function WPCW_showPage_Dashboard_load()
{
    $page = new PageBuilder(false);
    $page->showPageHeader(__('My Training Courses', 'wp_courseware'), '75%', WPCW_icon_getPageIconURL());
    // Handle any deletion
    WPCW_handler_processDeletion($page);
    // Handle the sorting and filtering
    $orderBy = WPCW_arrays_getValue($_GET, 'orderby');
    $ordering = WPCW_arrays_getValue($_GET, 'order');
    // Validate ordering
    switch ($orderBy) {
        case 'course_title':
        case 'course_id':
            break;
        default:
            $orderBy = 'course_title';
            break;
    }
    // Create opposite ordering for reversing it.
    $ordering_opposite = false;
    switch ($ordering) {
        case 'desc':
            $ordering_opposite = 'asc';
            break;
        case 'asc':
            $ordering_opposite = 'desc';
            break;
        default:
            $ordering = 'asc';
            $ordering_opposite = 'desc';
            break;
    }
    // This data has been validated, so ok to use without prepare
    global $wpcwdb, $wpdb;
    $SQL = "\n\t\t\tSELECT * \n\t\t\tFROM {$wpcwdb->courses}\n\t\t\tORDER BY {$orderBy} {$ordering}";
    $courses = $wpdb->get_results($SQL);
    if ($courses) {
        $tbl = new TableBuilder();
        $tbl->attributes = array('id' => 'wpcw_tbl_course_summary', 'class' => 'widefat wpcw_tbl');
        // ID - sortable
        $sortableLink = sprintf('<a href="%s&order=%s&orderby=course_id"><span>%s</span><span class="sorting-indicator"></span></a>', admin_url('admin.php?page=WPCW_wp_courseware'), 'course_id' == $orderBy ? $ordering_opposite : 'asc', __('ID', 'wp_courseware'));
        // ID - render
        $tblCol = new TableColumn($sortableLink, 'course_id');
        $tblCol->cellClass = "course_id";
        $tblCol->headerClass = 'course_id' == $orderBy ? 'sorted ' . $ordering : 'sortable';
        $tbl->addColumn($tblCol);
        // Title - sortable
        $sortableLink = sprintf('<a href="%s&order=%s&orderby=course_title"><span>%s</span><span class="sorting-indicator"></span></a>', admin_url('admin.php?page=WPCW_wp_courseware'), 'course_title' == $orderBy ? $ordering_opposite : 'asc', __('Course Title', 'wp_courseware'));
        // Title - render
        $tblCol = new TableColumn($sortableLink, 'course_title');
        $tblCol->headerClass = 'course_title' == $orderBy ? 'sorted ' . $ordering : 'sortable';
        $tblCol->cellClass = "course_title";
        $tbl->addColumn($tblCol);
        $tblCol = new TableColumn(__('Description', 'wp_courseware'), 'course_desc');
        $tblCol->cellClass = "course_desc";
        $tbl->addColumn($tblCol);
        $tblCol = new TableColumn(__('Settings', 'wp_courseware'), 'course_settings');
        $tblCol->cellClass = "course_settings";
        $tbl->addColumn($tblCol);
        $tblCol = new TableColumn(__('Total Units', 'wp_courseware'), 'total_units');
        $tblCol->cellClass = "total_units";
        $tbl->addColumn($tblCol);
        $tblCol = new TableColumn(__('Modules', 'wp_courseware'), 'course_modules');
        $tblCol->cellClass = "course_modules";
        $tbl->addColumn($tblCol);
        $tblCol = new TableColumn(__('Actions', 'wp_courseware'), 'actions');
        $tblCol->cellClass = "actions";
        $tbl->addColumn($tblCol);
        // Links
        $editURL = admin_url('admin.php?page=WPCW_showPage_ModifyCourse');
        $url_addModule = admin_url('admin.php?page=WPCW_showPage_ModifyModule');
        $url_ordering = admin_url('admin.php?page=WPCW_showPage_CourseOrdering');
        $url_gradeBook = admin_url('admin.php?page=WPCW_showPage_GradeBook');
        // Format row data and show it.
        $odd = false;
        foreach ($courses as $course) {
            $data = array();
            // Basic Details
            $data['course_id'] = $course->course_id;
            $data['course_desc'] = $course->course_desc;
            // Editing Link
            $data['course_title'] = sprintf('<a href="%s&course_id=%d">%s</a>', $editURL, $course->course_id, $course->course_title);
            // Actions
            $data['actions'] = '<ul>';
            $data['actions'] .= sprintf('<li><a href="%s&course_id=%d" class="button-primary">%s</a></li>', $url_addModule, $course->course_id, __('Add Module', 'wp_courseware'));
            $data['actions'] .= sprintf('<li><a href="%s&course_id=%d" class="button-secondary">%s</a></li>', $editURL, $course->course_id, __('Edit Course Settings', 'wp_courseware'));
            $data['actions'] .= sprintf('<li><a href="%s&course_id=%d" class="button-secondary">%s</a></li>', $url_ordering, $course->course_id, __('Modules, Units &amp; Quiz Ordering', 'wp_courseware'));
            $data['actions'] .= sprintf('<li><a href="%s&course_id=%d" class="button-secondary">%s</a></li>', $url_gradeBook, $course->course_id, __('Access Grade Book', 'wp_courseware'));
            $data['actions'] .= '</ul>';
            // Settings Summary - to allow user to see a quick overview of the current settings.
            $data['course_settings'] = '<ul class="wpcw_tickitems">';
            // Access control - filtered if membership plugin
            $data['course_settings'] .= apply_filters('wpcw_extensions_access_control_override', sprintf('<li class="wpcw_%s">%s</li>', 'default_show' == $course->course_opt_user_access ? 'enabled' : 'disabled', __('Give new users access by default', 'wp_courseware')));
            // Completion wall
            $data['course_settings'] .= sprintf('<li class="wpcw_%s">%s</li>', 'completion_wall' == $course->course_opt_completion_wall ? 'enabled' : 'disabled', __('Require unit completion before showing next', 'wp_courseware'));
            // Certificate handling
            $data['course_settings'] .= sprintf('<li class="wpcw_%s">%s</li>', 'use_certs' == $course->course_opt_use_certificate ? 'enabled' : 'disabled', __('Generate certificates on course completion', 'wp_courseware'));
            $data['course_settings'] .= '</ul>';
            // Module list
            $data['course_modules'] = false;
            $moduleList = WPCW_courses_getModuleDetailsList($course->course_id);
            $moduleIDList = array();
            if ($moduleList) {
                foreach ($moduleList as $item_id => $moduleObj) {
                    $modName = sprintf('%s %d - %s', __('Module', 'wp_courseware'), $moduleObj->module_number, $moduleObj->module_title);
                    // Create each module item with an edit link.
                    $modEditURL = admin_url('admin.php?page=WPCW_showPage_ModifyModule&module_id=' . $item_id);
                    $data['course_modules'] .= sprintf('<li><a href="%s" title="%s \'%s\'">%s</a></li>', $modEditURL, __('Edit Module', 'wp_courseware'), $modName, $modName);
                    // Just want module IDs
                    $moduleIDList[] = $item_id;
                }
            } else {
                $data['course_modules'] = __('No modules yet.', 'wp_courseware');
            }
            // Unit Count
            if (count($moduleIDList) > 0) {
                $data['total_units'] = $wpdb->get_var("\n\t\t\t\t\tSELECT COUNT(*) \n\t\t\t\t\tFROM {$wpcwdb->units_meta} \n\t\t\t\t\tWHERE parent_module_id IN (" . implode(",", $moduleIDList) . ")");
            } else {
                $data['total_units'] = '0';
            }
            // Odd/Even row colouring.
            $odd = !$odd;
            $rowClass = $odd ? 'alternate' : '';
            // Get a list of all quizzes for the specified parent course.
            $listOfQuizzes = $wpdb->get_col($wpdb->prepare("\n\t\t\t\tSELECT quiz_id\n\t\t\t\tFROM {$wpcwdb->quiz}\n\t\t\t\tWHERE parent_course_id = %d\n\t\t\t", $course->course_id));
            $countOfQuizzesNeedingGrading = false;
            $countOfQuizzesNeedingManualHelp = false;
            // Determine if there are any quizzes that need marking. If so, how many?
            if (!empty($listOfQuizzes)) {
                $quizIDList = '(' . implode(',', $listOfQuizzes) . ')';
                $countOfQuizzesNeedingGrading = $wpdb->get_var("\n\t\t\t\t\tSELECT COUNT(*)\n\t\t\t\t\tFROM {$wpcwdb->user_progress_quiz}\n\t\t\t\t\tWHERE quiz_id IN {$quizIDList}\n\t\t\t\t\t  AND quiz_needs_marking > 0\n\t\t\t\t\t  AND quiz_is_latest = 'latest'\n\t\t\t\t");
                $countOfQuizzesNeedingManualHelp = $wpdb->get_var("\n\t\t\t\t\tSELECT COUNT(*)\n\t\t\t\t\tFROM {$wpcwdb->user_progress_quiz}\n\t\t\t\t\tWHERE quiz_id IN {$quizIDList}\n\t\t\t\t\t  AND quiz_next_step_type = 'quiz_fail_no_retakes'\n\t\t\t\t\t  AND quiz_is_latest = 'latest'\n\t\t\t\t");
            }
            // Have we got any custom data for this row?
            $tblCustomRowStr = false;
            // Show the status message about quizzes needing marking.
            if ($countOfQuizzesNeedingGrading) {
                // Create message that quizzes need marking.
                $tblCustomRowStrTmp = __('This course has ', 'wp_courseware') . _n('1 quiz that requires', '%d quizzes that require', $countOfQuizzesNeedingGrading, 'wp_courseware') . __(' manual grading.', 'wp_courseware');
                $tblCustomRowStr .= '<span>' . sprintf($tblCustomRowStrTmp, $countOfQuizzesNeedingGrading) . '</span>';
            }
            // Show the status message about quizzes needing manual intervention.
            if ($countOfQuizzesNeedingManualHelp) {
                // Create message that quizzes need marking.
                $tblCustomRowStrTmp = __('This course has ', 'wp_courseware') . _n('1 user that is', '%d users that are', $countOfQuizzesNeedingManualHelp, 'wp_courseware') . __(' blocked due to too many failed attempts.', 'wp_courseware');
                $tblCustomRowStr .= '<span>' . sprintf($tblCustomRowStrTmp, $countOfQuizzesNeedingManualHelp) . '</span>';
            }
            // Add a row for the status data, hiding the border above it.
            if ($tblCustomRowStr) {
                // Create a row that also hides the border below it.
                $tbl->addRow($data, 'wpcw_tbl_row_status_pre ' . $rowClass);
                $tblRow = new RowDataSimple('wpcw_tbl_row_status ' . $rowClass, $tblCustomRowStr, 7);
                $tbl->addRowObj($tblRow);
            } else {
                $tbl->addRow($data, $rowClass);
            }
        }
        // Finally show table
        echo $tbl->toString();
    } else {
        printf('<p>%s</p>', __('There are currently no courses to show. Why not create one?', 'wp_courseware'));
    }
    $page->showPageFooter();
}
Esempio n. 11
0
/**
 * Shows a detailed summary of the user's quiz or survey answers.
 */
function WPCW_showPage_UserProgess_quizAnswers_load()
{
    global $wpcwdb, $wpdb;
    $wpdb->show_errors();
    $page = new PageBuilder(false);
    $page->showPageHeader(__('Detailed User Quiz/Survey Results', 'wp_courseware'), '75%', WPCW_icon_getPageIconURL());
    $userID = WPCW_arrays_getValue($_GET, 'user_id') + 0;
    $unitID = WPCW_arrays_getValue($_GET, 'unit_id') + 0;
    $quizID = WPCW_arrays_getValue($_GET, 'quiz_id') + 0;
    // Create a link back to the detailed user progress, and back to all users.
    printf('<div class="wpcw_button_group">');
    // Link back to all user summary
    printf('<a href="%s" class="button-secondary">%s</a>&nbsp;&nbsp;', admin_url('users.php'), __('&laquo; Return to User Summary', 'wp_courseware'));
    if ($userDetails = get_userdata($userID)) {
        // Link back to user's personal summary
        printf('<a href="%s&user_id=%d" class="button-secondary">%s</a>&nbsp;&nbsp;', admin_url('users.php?page=WPCW_showPage_UserProgess'), $userDetails->ID, sprintf(__('&laquo; Return to <b>%s\'s</b> Progress Report', 'wp_courseware'), $userDetails->display_name));
    }
    // Try to get the full detailed results.
    $results = WPCW_quizzes_getUserResultsForQuiz($userID, $unitID, $quizID);
    // No results, so abort.
    if (!$results) {
        // Close the button wrapper for above early
        printf('</div>');
        // .wpcw_button_group
        $page->showMessage(__('Sorry, but no results could be found.', 'wp_courseware'), true);
        $page->showPageFooter();
        return;
    }
    // Could potentially have an issue where the quiz has been deleted
    // but the data exists.. small chance though.
    $quizDetails = WPCW_quizzes_getQuizDetails($quizID, true, true, $userID);
    // Extra button - return to gradebook
    printf('<a href="%s&course_id=%d" class="button-secondary">%s</a>&nbsp;&nbsp;', admin_url('admin.php?page=WPCW_showPage_GradeBook'), $quizDetails->parent_course_id, __("&laquo; Return to Gradebook", 'wp_courseware'));
    printf('</div>');
    // .wpcw_button_group
    // #### 1 - Handle grades being updated
    $results = WPCW_showPage_UserProgess_quizAnswers_handingGrading($quizDetails, $results, $page, $userID, $unitID);
    // #### 2A - Check if next action for user has been triggered by the admin.
    $results = WPCW_showPage_UserProgess_quizAnswers_whatsNext_savePreferences($quizDetails, $results, $page, $userID, $unitID);
    // #### 2B - Handle telling admin what's next
    WPCW_showPage_UserProgess_quizAnswers_whatsNext($quizDetails, $results, $page, $userID, $unitID);
    //Ê#### 3 - Handle sending emails if something has changed.
    if (isset($results->sendOutEmails) && $results->sendOutEmails) {
        $extraDetail = isset($results->extraEmailDetail) ? $results->extraEmailDetail : '';
        // Only called if the quiz was graded.
        if (isset($results->quiz_has_just_been_graded) && $results->quiz_has_just_been_graded) {
            // Need to call the action anyway, but any functions hanging off this
            // should check if the admin wants users to have notifications or not.
            do_action('wpcw_quiz_graded', $userID, $quizDetails, number_format($results->quiz_grade, 1), $extraDetail);
        }
        $courseDetails = WPCW_courses_getCourseDetails($quizDetails->parent_course_id);
        if ($courseDetails->email_quiz_grade_option == 'send_email') {
            // Message is only if quiz has been graded.
            if (isset($results->quiz_has_just_been_graded) && $results->quiz_has_just_been_graded) {
                $page->showMessage(__('The user has been sent an email with their grade for this course.', 'wp_courseware'));
            }
        }
    }
    // #### - Table 1 - Overview
    printf('<h3>%s</h3>', __('Quiz/Survey Overview', 'wp_courseware'));
    $tbl = new TableBuilder();
    $tbl->attributes = array('id' => 'wpcw_tbl_progress_quiz_info', 'class' => 'widefat wpcw_tbl');
    $tblCol = new TableColumn(false, 'quiz_label');
    $tblCol->cellClass = 'wpcw_tbl_label';
    $tbl->addColumn($tblCol);
    $tblCol = new TableColumn(false, 'quiz_detail');
    $tbl->addColumn($tblCol);
    // These are the base details for the quiz to show.
    $summaryData = array(__('Quiz Title', 'wp_courseware') => $quizDetails->quiz_title, __('Quiz Description', 'wp_courseware') => $quizDetails->quiz_desc, __('Quiz Type', 'wp_courseware') => WPCW_quizzes_getQuizTypeName($quizDetails->quiz_type), __('No. of Questions', 'wp_courseware') => $results->quiz_question_total, __('Completed Date', 'wp_courseware') => __('About', 'wp_courseware') . ' ' . human_time_diff($results->quiz_completed_date_ts) . ' ' . __('ago', 'wp_courseware') . '<br/><small>(' . date('D jS M Y \\a\\t H:i:s', $results->quiz_completed_date_ts) . ')</small>', __('Number of Quiz Attempts', 'wp_courseware') => $results->attempt_count, __('Permitted Quiz Attempts', 'wp_courseware') => -1 == $quizDetails->quiz_attempts_allowed ? __('Unlimited', 'wp_courseware') : $quizDetails->quiz_attempts_allowed);
    // Quiz details relating to score, etc.
    if ('survey' != $quizDetails->quiz_type) {
        $summaryData[__('Pass Mark', 'wp_courseware')] = $quizDetails->quiz_pass_mark . '%';
        // Still got items to grade
        if ($results->quiz_needs_marking > 0) {
            $summaryData[__('No. of Questions to Grade', 'wp_courseware')] = '<span class="wpcw_status_info wpcw_icon_pending">' . $results->quiz_needs_marking . '</span>';
            $summaryData[__('Overall Grade', 'wp_courseware')] = '<span class="wpcw_status_info wpcw_icon_pending">' . __('Awaiting Final Grading', 'wp_courseware') . '</span>';
        } else {
            $summaryData[__('No. of Question to Grade', 'wp_courseware')] = '-';
            // Show if PASSED or FAILED with the overall grade.
            $gradeData = false;
            if ($results->quiz_grade >= $quizDetails->quiz_pass_mark) {
                $gradeData = sprintf('<span class="wpcw_tbl_progress_quiz_overall wpcw_question_yesno_status wpcw_question_yes">%s%% %s</span>', number_format($results->quiz_grade, 1), __('Passed', 'wp_courseware'));
            } else {
                $gradeData = sprintf('<span class="wpcw_tbl_progress_quiz_overall wpcw_question_yesno_status wpcw_question_no">%s%% %s</span>', number_format($results->quiz_grade, 1), __('Failed', 'wp_courseware'));
            }
            $summaryData[__('Overall Grade', 'wp_courseware')] = $gradeData;
        }
    }
    foreach ($summaryData as $label => $data) {
        $tbl->addRow(array('quiz_label' => $label . ':', 'quiz_detail' => $data));
    }
    echo $tbl->toString();
    // ### 4 - Form Code - to allow instructor to send data back to
    printf('<form method="POST" id="wpcw_tbl_progress_quiz_grading_form">');
    printf('<input type="hidden" name="grade_answers_submitted" value="true">');
    // ### 5 - Table 2 - Each Specific Quiz
    $questionNumber = 0;
    if ($results->quiz_data && count($results->quiz_data) > 0) {
        foreach ($results->quiz_data as $questionID => $answer) {
            $data = $answer;
            // Get the question type
            if (isset($quizDetails->questions[$questionID])) {
                // Store as object for easy reference.
                $quObj = $quizDetails->questions[$questionID];
                // Render the question as a table.
                printf('<h3>%s #%d - %s</h3>', __('Question', 'wp_courseware'), ++$questionNumber, $quObj->question_question);
                $tbl = new TableBuilder();
                $tbl->attributes = array('id' => 'wpcw_tbl_progress_quiz_info', 'class' => 'widefat wpcw_tbl wpcw_tbl_progress_quiz_answers_' . $quObj->question_type);
                $tblCol = new TableColumn(false, 'quiz_label');
                $tblCol->cellClass = 'wpcw_tbl_label';
                $tbl->addColumn($tblCol);
                $tblCol = new TableColumn(false, 'quiz_detail');
                $tbl->addColumn($tblCol);
                $theirAnswer = false;
                switch ($quObj->question_type) {
                    case 'truefalse':
                    case 'multi':
                        $theirAnswer = $answer['their_answer'];
                        break;
                        // File Upload - create a download link
                    // File Upload - create a download link
                    case 'upload':
                        $theirAnswer = sprintf('<a href="%s%s" target="_blank" class="button-primary">%s .%s %s (%s)</a>', WP_CONTENT_URL, $answer['their_answer'], __('Open', 'wp_courseware'), pathinfo($answer['their_answer'], PATHINFO_EXTENSION), __('File', 'wp_courseware'), WPCW_files_getFileSize_human($answer['their_answer']));
                        break;
                        // Open Ended - Wrap in span tags, to cap the size of the field, and format new lines.
                    // Open Ended - Wrap in span tags, to cap the size of the field, and format new lines.
                    case 'open':
                        $theirAnswer = '<span class="wpcw_q_answer_open_wrap"><textarea readonly>' . $data['their_answer'] . '</textarea></span>';
                        break;
                }
                // end of $theirAnswer check
                $summaryData = array(__('Type', 'wp_courseware') => array('data' => WPCW_quizzes_getQuestionTypeName($quObj->question_type), 'cssclass' => ''), __('Their Answer', 'wp_courseware') => array('data' => $theirAnswer, 'cssclass' => ''));
                // Just for quizzes - show answers/grade
                if ('survey' != $quizDetails->quiz_type) {
                    switch ($quObj->question_type) {
                        case 'truefalse':
                        case 'multi':
                            // The right answer...
                            $summaryData[__('Correct Answer', 'wp_courseware')] = array('data' => $answer['correct'], 'cssclass' => '');
                            // Did they get it right?
                            $getItRight = sprintf('<span class="wpcw_question_yesno_status wpcw_question_%s">%s</span>', $answer['got_right'], 'yes' == $answer['got_right'] ? __('Yes', 'wp_courseware') : __('No', 'wp_courseware'));
                            $summaryData[__('Did they get it right?', 'wp_courseware')] = array('data' => $getItRight, 'cssclass' => '');
                            break;
                        case 'upload':
                        case 'open':
                            $gradeHTML = false;
                            $theirGrade = WPCW_arrays_getValue($answer, 'their_grade');
                            // Not graded - show select box.
                            if ($theirGrade == 0) {
                                $cssClass = 'wpcw_grade_needs_grading';
                            } else {
                                $cssClass = 'wpcw_grade_already_graded';
                                $gradeHTML = sprintf('<span class="wpcw_grade_view">%d%% <a href="#">(%s)</a></span>', $theirGrade, __('Click to edit', 'wp_courseware'));
                            }
                            // Not graded yet, allow admin to grade the quiz, or change
                            // the grading later if they want to.
                            $gradeHTML .= WPCW_forms_createDropdown('grade_quiz_' . $quObj->question_id, WPCW_quizzes_getPercentageList(__('-- Select a grade --', 'wp_courseware')), $theirGrade, false, 'wpcw_tbl_progress_quiz_answers_grade');
                            $summaryData[__('Their Grade', 'wp_courseware')] = array('data' => $gradeHTML, 'cssclass' => $cssClass);
                            break;
                    }
                }
                // Check of showing the right answer.
                foreach ($summaryData as $label => $data) {
                    $tbl->addRow(array('quiz_label' => $label . ':', 'quiz_detail' => $data['data']), $data['cssclass']);
                }
                echo $tbl->toString();
            }
            // end if (isset($quizDetails->questions[$questionID]))
        }
        // foreach ($results->quiz_data as $questionID => $answer)
    }
    printf('</form>');
    // Shows a bar that pops up, allowing the user to easily save all grades that have changed.
    ?>
	<div id="wpcw_sticky_bar" style="display: none">
		<div id="wpcw_sticky_bar_inner">
			<a href="#" id="wpcw_tbl_progress_quiz_grading_updated" class="button-primary"><?php 
    _e('Save Changes to Grades', 'wp_courseware');
    ?>
</a>
			<span id="wpcw_sticky_bar_status" title="<?php 
    _e('Grades have been changed. Ready to save changes?', 'wp_courseware');
    ?>
"></span>
		</div>
	</div>
	<br/><br/><br/><br/>
	<?php 
    $page->showPageFooter();
}
Esempio n. 12
0
/**
 * Function that shows the settings page.
 */
function STWWT_showPage_Settings()
{
    /**
     * Constant: Documentation on how the mouseover bubble works.
     */
    define('STWWT_DESC_MOUSEOVER', '
		<p><img src="' . STWWT_plugin_getPluginPath() . 'img/stw_bubble_example.png" class="stwwt_settings_bubble_example"/> 
		The Shrink The Web mouseover bubble shows a thumbnail of the website when hovered over a link on your WordPress website. 
		This gives website visitors a preview of the link before they visit the website you link to.</p>
		<p>If the "<b>Automatic</b>" is selected below, all external links will show ShrinkTheWeb preview bubbles. Use <code>class="nopopup"</code> to disable popup bubble for a specific link.</p>
		<p>If the "<b>Manual</b>" method is selected below, then you choose which links get a preview bubble by adding <code>class="stwpopup"</code> to any link where you want to show them.</p>
		<div class="stwwt_clear"></div>
	');
    /**
     * Constant: Documentation on how the embedded code works.
     */
    define('STWWT_DESC_EMBEDDED', '
		<p>The Shrink The Web embed code shows a thumbnail for any link you wrap in <code>[thumb][/thumb]</code> or <code>[stwthumb][/stwthumb]</code> tags. Any use of these tags is replaced with the thumbnail of the website included in the tags. <a href="admin.php?page=stwwt_documentation#embed">See some examples on the documentation page</a>.

	');
    /**
     * Constant: Documentation on how the pro features work.
     */
    define('STWWT_DESC_EMBEDDED_PRO', '
		<p>The following features <b>require an upgraded account</b>. You can find more details on the <a href="https://www.shrinktheweb.com/auth/order-page" target="_blank">Shrink The Web Upgrade Page</a>.</p>
		<p>These settings are <b>global</b>, so they apply to <b>all thumbnails</b> on your website. Some of these settings have a per-thumbnail override, so please read <a href="admin.php?page=stwwt_documentation">the documentation</a> on how to apply these settings to specific thumbnails.</p>
	');
    $page = new PageBuilder(true);
    $page->showPageHeader(__('Shrink The Web - Website Thumbnails - Settings', 'stwwt'), '70%');
    $page->openPane('stw_settings_main', 'Thumbnail Settings');
    $settingDetails = array('stwwt_break_main' => array('type' => 'break', 'html' => STWWT_forms_createBreakHTML('Account Settings')), 'stwwt_access_id' => array('label' => 'Access Key Id', 'type' => 'text', 'required' => true, 'cssclass' => 'stwwt_access_id', 'desc' => 'Your Shrink The Web <b>access</b> key. You can find this within your <a href="http://www.shrinktheweb.com/auth/stw-lobby" target="_blank">STW Account Details</a>.', 'validate' => array('type' => 'string', 'regexp' => '/^[A-Za-z0-9]{12,20}$/', 'error' => 'Your STW access key should only contain numbers and letters, and it\'s about 15 characters long.')), 'stwwt_secret_id' => array('label' => 'Secret Key Id', 'type' => 'text', 'required' => true, 'cssclass' => 'stwwt_access_id', 'desc' => 'Your Shrink The Web <b>secret</b> key. You can find this within your <a href="http://www.shrinktheweb.com/auth/stw-lobby" target="_blank">STW Account Details</a>.', 'validate' => array('type' => 'string', 'regexp' => '/^[A-Za-z0-9]{5,10}$/', 'error' => 'Your STW access key should only contain numbers and letters, and it\'s about 5 characters long.')), 'stwwt_account_level' => array('label' => 'Your STW Account Level', 'type' => 'custom', 'html' => false, 'desc' => 'If you change any aspects of your Shrink The Web account (such as upgrades), click on the <b>Save All Settings</b> button below to re-load what features you can use.'), 'stwwt_break_embedded' => array('type' => 'break', 'html' => STWWT_forms_createBreakHTML('Screenshot Settings', 'Save ALL Settings') . '<div class="stwwt_description">' . STWWT_DESC_EMBEDDED . '</div>'), 'stwwt_shortcode' => array('label' => 'Shortcode Syntax', 'type' => 'radio', 'data' => array('stwthumb' => '<b>[stwthumb]</b>', 'thumb' => '[thumb]'), 'default' => 'thumb'), 'stwwt_embedded_default_size' => array('label' => 'Default Screenshot Size', 'type' => 'select', 'data' => array('mcr' => 'Micro (75x56)', 'tny' => 'Tiny (90x68)', 'vsm' => 'Very Small (100x75)', 'sm' => 'Small (120x90)', 'lg' => 'Large (200x150)', 'xlg' => 'Extra Large (320x200)'), 'desc' => 'The size of the thumbnail shown by the thumbnail shortcode.', 'default' => 'lg'), 'stwwt_embedded_cache_length' => array('label' => 'Cache Length in Days', 'type' => 'select', 'data' => array('3' => '3 Days', '7' => '7 Days (recommended)', '10' => '10 Days', '14' => '14 Days', '21' => '21 Days', '30' => '30 Days'), 'desc' => 'How long you want to cache the thumbnails for.', 'account_level' => array('basic', 'plus'), 'account_denied_msg' => STWWT_ACCOUNT_UPGRADE, 'default' => 7), 'stwwt_break_embedded_pro' => array('type' => 'break', 'html' => STWWT_forms_createBreakHTML('PRO Feature Settings', 'Save ALL Settings') . '<div class="stwwt_description">' . STWWT_DESC_EMBEDDED_PRO . '</div>'), 'stwwt_embedded_pro_inside' => array('label' => 'Inside Pages Capture', 'type' => 'radio', 'data' => array('enable' => '<b>Enabled</b>', 'disable' => 'Disabled'), 'account_feature' => 'embedded_pro_inside', 'account_denied_msg' => STWWT_FEATURE_UPGRADE, 'default' => 'disable'), 'stwwt_embedded_pro_full_length' => array('label' => 'Full-length Page Captures', 'type' => 'radio', 'data' => array('enable' => '<b>Enabled</b>', 'disable' => 'Disabled'), 'account_feature' => 'embedded_pro_full_length', 'account_denied_msg' => STWWT_FEATURE_UPGRADE, 'default' => 'disable'), 'stwwt_embedded_pro_custom_quality' => array('label' => 'Custom Thumbnail Quality', 'type' => 'select', 'data' => STWWT_getQualityList(), 'desc' => 'If you want to customise the thumbnail image quality, then you can select a quality value between 1% and 100%. A value of <b>1% is the lowest quality</b>, and <b>100% is the best quality</b>.', 'account_feature' => 'embedded_pro_custom_quality', 'account_denied_msg' => STWWT_FEATURE_UPGRADE), 'stwwt_break_bubble' => array('type' => 'break', 'html' => STWWT_forms_createBreakHTML('Mouseover Bubble Settings', 'Save ALL Settings') . '<div class="stwwt_description">' . STWWT_DESC_MOUSEOVER . '</div>'), 'stwwt_bubble_method' => array('label' => 'Preview Bubbles Show Method', 'type' => 'select', 'data' => array('disable' => 'Disabled', 'automatic' => 'Automatic', 'manual' => 'Manual'), 'default' => 'disable'), 'stwwt_bubble_size' => array('label' => 'Preview Bubbles Thumbnail Size', 'type' => 'select', 'data' => array('sm' => 'Small (120x90)', 'lg' => 'Large (200x150)', 'xlg' => 'Extra Large (320x200)'), 'desc' => 'The size of the thumbnail shown in the preview bubble when a website visitor hovers over a link.', 'default' => 'lg'));
    // Show main settings form
    $settings = new STWSettingsForm($settingDetails, STWWT_SETTINGS_KEY, 'stwwt_settings');
    $settings->setSaveButtonLabel('Save ALL Settings');
    $settings->show();
    // #### Support section
    $page->showPageMiddle('27%');
    $yes = sprintf('<img src="%simg/icon_%s.png" />', STWWT_plugin_getPluginPath(), 'tick');
    $no = sprintf('<img src="%simg/icon_%s.png" />', STWWT_plugin_getPluginPath(), 'cross');
    // Feature check
    $accountSettings = TidySettings_getSettings(STWWT_SETTINGS_KEY_ACCOUNT);
    if ($accountSettings) {
        $page->openPane('stw_settings_support', 'Your Account Features');
        ?>
			<table id="stwwt_feature_comp">
				<thead>
					<tr>
						<th>Feature</th>
						<th>Your Account</th>
					</tr>
				</thead>
				<tbody>										
					<?php 
        // Now show the features
        unset($accountSettings['account_type']);
        // So we can just loop through settings.
        foreach ($accountSettings as $settingName => $enabled) {
            switch ($settingName) {
                case 'embedded_pro_inside':
                    printf('<tr><th>%s</th><td>%s</td></tr>', 'Inside Pages Capture', 1 == $enabled ? $yes : $no);
                    break;
                case 'embedded_pro_full_length':
                    printf('<tr><th>%s</th><td>%s</td></tr>', 'Full Length Capture', 1 == $enabled ? $yes : $no);
                    break;
                case 'embedded_pro_custom_size':
                    printf('<tr><th>%s</th><td>%s</td></tr>', 'Custom Sizes', 1 == $enabled ? $yes : $no);
                    break;
                case 'embedded_pro_custom_quality':
                    printf('<tr><th>%s</th><td>%s</td></tr>', 'Custom Quality', 1 == $enabled ? $yes : $no);
                    break;
                    // Don't show feature
                // Don't show feature
                default:
                    break;
            }
        }
        ?>
					
				</tbody>
			</table>
	
		<?php 
        $page->closePane();
    }
    // end of your feature list
    $page->openPane('stw_settings_support', 'Get a STW Account...');
    ?>
	<div id="stwwt_signup">
			<a href="http://www.shrinktheweb.com/user/register" target="_blank">
				<img src="http://www.shrinktheweb.com/uploads/stw-banners/shrinktheweb-234x60.gif" alt="Website Thumbnail Provider" class="stwwt_settings_banner" width="234" height="60" alt="Register for a free account with Shrink The Web">
			</a>
			
			<div class="stwwt_settings_banner_text">
				<span>Need an account?</span>
				<a href="http://www.shrinktheweb.com/user/register" target="_blank" class="button-primary">Register for FREE</a>
			</div>
		</div>

	<?php 
    $page->closePane();
    // Support
    $page->openPane('stw_settings_support', 'Help &amp; Support');
    ?>
	<p>If you've got a problem with the plugin, please follow the following steps.</p>
	<ol>
		<li>Check the <a href="http://wordpress.org/extend/plugins/shrinktheweb-website-preview-plugin/faq/" target="_blank">Frequently Asked Questions</a> on WordPress.org. Your issue might already be answered or resolved.</li>
		<li>Check the <a href="http://wordpress.org/tags/shrinktheweb-website-preview-plugin?forum_id=10" target="_blank">plugin support forum</a> on WordPress.org. Someone might have had the same issue, and fixed it already.</li>
		<li>If you think the problem is a <b>plugin problem</b>, please raise the problem in the <a href="http://wordpress.org/tags/shrinktheweb-website-preview-plugin?forum_id=10" target="_blank">plugin support forum</a> on WordPress.org, including <b>as much detail as possible</b>, including any <b>error messages</b>.</li>
		<li>If you think the problem is a <b>STW or STW account problem</b>, please raise the problem in the <a href="http://www.shrinktheweb.com/forum" target="_blank">STW support forum</a>, including <b>as much detail as possible</b>, including any <b>error messages</b>.</li>
	</ol>
	
	<br/>
	<div class="stwwt_title">A word about the plugin authors...</div>
	<p>This plugin and the <a href="http://www.shrinktheweb.com" target="_blank">Shrink The Web</a> service has been developed and is provided by <a href="http://www.neosys.net/profile.htm" target="_blank">Neosys Consulting, Inc.</a></p>
	<?php 
    $page->closePane();
    $page->showPageFooter();
}
Esempio n. 13
0
    /**
     * @param PageBuilder $pageBuilder
     * @return ContactsPanel
     */
    function CNewMessagePanel(&$pagebuilder)
    {
        $this->Type = Post::val('mtype', 'mes');
        $this->To = '';
        $this->_pagebuilder =& $pagebuilder;
        $this->_proc =& $pagebuilder->_proc;
        $this->From = $this->_getFromEmail();
        $this->_pagebuilder->_top->AddOnResize('ResizeElements(\'all\');');
        if ($this->_proc->account->AllowDhtmlEditor) {
            $editorResize = 'HTMLEditor.Resize(width - 1, height - 2);';
            $editorReplace = 'HTMLEditor.Replace();';
        } else {
            $editorResize = '
						plainEditor.style.height = (height - 1) + "px";
						plainEditor.style.width = (width - 2) + "px";
					';
            $editorReplace = '';
        }
        $this->inputs = '';
        $contacts = null;
        if (Post::has('contacts') && is_array(Post::val('contacts'))) {
            $contactsArray = array_keys(Post::val('contacts'));
            $contacts =& $this->_proc->db->LoadContactsById($contactsArray);
        }
        if (Post::has('groupid')) {
            $group =& $this->_proc->db->SelectGroupById(Post::val('groupid', -1));
            $contacts =& $this->_proc->db->SelectAddressGroupContacts(Post::val('groupid', -1));
        }
        if ($contacts) {
            foreach ($contacts->Instance() as $contact) {
                if (!$contact->Email) {
                    continue;
                }
                $this->To .= $contact->Name ? '"' . $contact->Name . '" <' . $contact->Email . '>, ' : $contact->Email . ',';
            }
            $this->To = trim(trim($this->To), ',');
        }
        if (Post::has('mailto')) {
            $this->To = Post::val('mailto', '');
        }
        if (Get::has('to')) {
            $this->To = (string) trim(Get::val('to', ''));
        }
        $message = null;
        $isHtml = $this->_proc->account->AllowDhtmlEditor;
        $this->attacmentsHtml = '';
        $this->_pagebuilder->AddJSText('
			
var bcc, bcc_mode, bcc_mode_switcher;

var plainCont = null;
var plainEditor = null;
var HTMLEditor = null;
var EditAreaUrl = "edit-area.php";
var prevWidth = 0;
var prevHeight = 0;
var rowIndex = 0;

function ResizeElements(mode) 
{
	var width = GetWidth();
	if (width < 684)
		width = 684;
	width = width - 40;
	var height = Math.ceil(width/3);
	
	if (prevWidth != width && prevHeight != height) {
		prevWidth = width;
		prevHeight = height;
		if (plainCont != null) {
			plainCont.style.height = height + "px";
			plainCont.style.width = width + "px";
			' . $editorResize . '
		}
	}
}

function WriteEmails(str, field)
{
	var mailInput;
	if (field == 2) {
		mailInput = document.getElementById("toCC");
	} else if (field == 3) {
		mailInput = document.getElementById("toBCC");
	} else {
		mailInput = document.getElementById("toemail");
	}
	if (mailInput) {
		mailInput.value = (mailInput.value == "") ? str : mailInput.value + ", " + str;
		mailInput.focus();
	}
}

function LoadAttachmentHandler(attachObj)
{
	var attachtable = document.getElementById("attachmentTable");
	if (attachObj)
	{
		var imageLink = GetFileParams(attachObj.FileName);
		var tr = attachtable.insertRow(rowIndex++);
		tr.id = "tr_" + attachObj.TempName;
		var td = tr.insertCell(0);
		td.className = "wm_attachment";
		var innerHtml = \'<img src="./images/icons/\' + imageLink.image + \'" />\';
		innerHtml += \'<input type="hidden" name="attachments[\' + attachObj.TempName + \']" value="\' + attachObj.FileName + \'">\';
		innerHtml += HtmlEncode(attachObj.FileName) + \' (\' + GetFriendlySize(attachObj.Size) + \') <a href="#" id="\' + attachObj.TempName + \'" onclick="return  DeleteAttach(this.id);">' . JS_LANG_Delete . '</a>\';
		td.innerHTML = innerHtml;
	}
}

function ChangeBCCMode()
{
	if (bcc_mode == "hide") {
		bcc_mode = "show";
		bcc.className = "";
		bcc_mode_switcher.innerHTML = Lang.HideBCC;
	} else {
		bcc_mode = "hide";
		bcc.className = "wm_hide";
		bcc_mode_switcher.innerHTML = Lang.ShowBCC;
	}
	' . $editorReplace . '
	return false;
}

function UpdateIdUid(id, uid)
{
	var idf = document.getElementById("m_id");
	var uidf = document.getElementById("m_uid");
	if (idf && uidf) {
		idf.value = id;
		uidf.value = uid;
	}
}

var Rep_m, Err_m;
var hiddensaveiframe;
var pop3Pr = ' . ($pagebuilder->_proc->account->MailProtocol == MAILPROTOCOL_POP3 ? 'true' : 'false') . ';
function DoSaveButton()
{
	if (pop3Pr)
	{ 
		if (!hiddensaveiframe) {
			hiddensaveiframe = CreateChildWithAttrs(document.body, "iframe", [["name", "hiddensaveiframe"], ["class", "wm_hide"]]);
		}
	}
	
	var form = document.getElementById("messageForm");
	form.action = "' . ACTIONFILE . '?action=save&req=message";
	form.target = (pop3Pr) ? "hiddensaveiframe" : "";

	if (submitSaveMessage()) {
		form.submit();
	}
}

function DoSendButton()
{
	var toemail = document.getElementById("toemail");
	var ccemail = document.getElementById("toCC");
	var bccemail = document.getElementById("toBCC");
	var subject = document.getElementById("subject");
	var mailIsCorrect = false;
	
	if ((toemail && toemail.value.length > 3) || (ccemail && ccemail.value.length > 3) || (bccemail && bccemail.value.length > 3)) { 
		mailIsCorrect = true;
	}
	
	if (mailIsCorrect) {
		if (subject && subject.value.length < 1 && !confirm(Lang.ConfirmEmptySubject)) {
			return false;
		}
		
		var form = document.getElementById("messageForm");
		form.action = "' . ACTIONFILE . '?action=send&req=message";
		form.target = "";
		if (submitSaveMessage()) {
			form.submit();
		}
	} else {
		alert(Lang.WarningToBlank);
	}
}

function DeleteAttach(idline)
{
	var trtable = document.getElementById("tr_" + idline);
	if (trtable)
	{
		trtable.className = "wm_hide";
		CleanNode(trtable);
	}
	return false;
}

function ShowPictures()
{
	var showPictureTable = document.getElementById("showpicturestable");

	if (HTMLEditor) {
		var temp = HTMLEditor.GetText().ReplaceStr("wmx_src", "src");
		temp = temp.ReplaceStr("wmx_background", "background");
		HTMLEditor.SetHtml(temp);
		if (showPictureTable) {
			showPictureTable.className = "wm_hide";
		}
		HTMLEditor.Replace();
	}
}

');
        $this->_pagebuilder->AddInitText('

bcc_mode = "hide";
bcc = document.getElementById("bcc");
bcc_mode_switcher = document.getElementById("bcc_mode_switcher");

plainEditor = document.getElementById("editor_area");
plainCont = document.getElementById("editor_cont");

Rep_m = new CReport("Rep_m");
Rep_m.Build();

Err_m = new CError("Err_m", "' . ConvertUtils::ClearJavaScriptString($this->_pagebuilder->SkinName(), '"') . '");
Err_m.Build();
');
        $m_id = -1;
        $m_uid = '';
        if (Post::has('m_id')) {
            $mes_id = Post::val('m_id');
            $mes_uid = Post::val('m_uid');
            $folder_id = Post::val('f_id');
            $folder_name = Post::val('f_name');
            $folder_name = 'defaultname';
            $mes_charset = Post::val('charset', -1);
            $message = new GetMessageBase($this->_proc->account, $mes_id, $mes_uid, $folder_id, $folder_name, $mes_charset);
            $m_id = (int) $mes_id;
            $m_uid = $mes_uid;
        }
        $this->inputs = '<input type="hidden" id="m_id" name="m_id" value="' . ConvertUtils::AttributeQuote($m_id) . '"><input type="hidden" id="m_uid" name="m_uid" value="' . ConvertUtils::AttributeQuote($m_uid) . '">';
        $withSignature = false;
        switch ($this->_proc->account->SignatureOptions) {
            case SIGNATURE_OPTION_AddToAll:
                $withSignature = true;
                break;
            case SIGNATURE_OPTION_AddToNewOnly:
                $withSignature = $this->Type == 'mes';
                break;
            default:
            case SIGNATURE_OPTION_DontAdd:
                $withSignature = false;
                break;
        }
        if ($message) {
            if ($this->Type != 'forward' && $this->Type != 'reply' && $this->Type != 'replytoall') {
                $withSignature = false;
            }
            $this->_pagebuilder->AddInitText('SetPriority(' . $message->msg->GetPriorityStatus() . ');');
            switch ($this->Type) {
                default:
                    $this->To = $message->PrintTo(true);
                    $this->CC = $message->PrintCC(true);
                    $this->BCC = '';
                    $this->Subject = $message->PrintSubject(true);
                    break;
                case 'forward':
                    $this->To = '';
                    $this->CC = '';
                    $this->BCC = '';
                    $this->Subject = JS_LANG_Fwd . ': ' . $message->PrintSubject(true);
                    break;
                case 'reply':
                    $replyto = trim($message->PrintReplyTo(true));
                    $this->To = strlen($replyto) > 0 ? $replyto : $message->PrintFrom(true);
                    $this->CC = '';
                    $this->BCC = '';
                    $this->Subject = JS_LANG_Re . ': ' . $message->PrintSubject(true);
                    break;
                case 'replytoall':
                    $emailCollection =& $message->msg->GetAllRecipients(false, true);
                    $temp = '';
                    if ($emailCollection) {
                        foreach ($emailCollection->Instance() as $value) {
                            $email =& $value;
                            if ($email->Email != $this->_proc->account->Email) {
                                $temp .= $email->Email . ', ';
                            }
                        }
                    }
                    $this->To = trim(trim($temp), ',');
                    $this->CC = '';
                    $this->BCC = '';
                    $this->Subject = JS_LANG_Re . ': ' . $message->PrintSubject(true);
                    break;
            }
            if ($this->_proc->account->AllowDhtmlEditor) {
                switch ($this->Type) {
                    case 'forward':
                    case 'reply':
                    case 'replytoall':
                        if ($message->account->ViewMode == VIEW_MODE_PREVIEW_PANE_NO_IMG || $message->account->ViewMode == VIEW_MODE_WITHOUT_PREVIEW_PANE_NO_IMG) {
                            $isHtml = true;
                            $this->Body = ConvertUtils::HtmlBodyWithoutImages($message->msg->GetRelpyAsHtml(true));
                            if (isset($GLOBALS[GL_WITHIMG]) && $GLOBALS[GL_WITHIMG]) {
                                $GLOBALS[GL_WITHIMG] = false;
                                $this->isSafety = false;
                            }
                        } else {
                            $isHtml = true;
                            $this->Body = ConvertUtils::HtmlBodyWithoutImages($message->msg->GetRelpyAsHtml(true));
                        }
                        break;
                    default:
                        if ($message->account->ViewMode == VIEW_MODE_PREVIEW_PANE_NO_IMG || $message->account->ViewMode == VIEW_MODE_WITHOUT_PREVIEW_PANE_NO_IMG) {
                            if ($message->msg->HasHtmlText()) {
                                $isHtml = true;
                                $this->Body = ConvertUtils::HtmlBodyWithoutImages($message->msg->GetCensoredHtmlWithImageLinks(true));
                                if (isset($GLOBALS[GL_WITHIMG]) && $GLOBALS[GL_WITHIMG]) {
                                    $GLOBALS[GL_WITHIMG] = false;
                                    $this->isSafety = false;
                                }
                            } elseif ($message->msg->HasPlainText()) {
                                $isHtml = false;
                                $this->Body = $message->msg->GetNotCensoredTextBody(true);
                            }
                        } else {
                            if ($message->msg->HasHtmlText()) {
                                $isHtml = true;
                                $this->Body = $message->msg->GetCensoredHtmlWithImageLinks(true);
                            } elseif ($message->msg->HasPlainText()) {
                                $isHtml = false;
                                $this->Body = $message->msg->GetNotCensoredTextBody(true);
                            }
                        }
                        break;
                }
            } else {
                $isHtml = false;
                switch ($this->Type) {
                    case 'forward':
                    case 'reply':
                    case 'replytoall':
                        $this->Body = $message->msg->GetRelpyAsPlain(true);
                        break;
                    default:
                        $this->Body = $message->msg->GetNotCensoredTextBody(true);
                        break;
                }
            }
            if ($message->HasAttachments() && $this->Type != 'reply' && $this->Type != 'replytoall') {
                $attachments =& $message->msg->Attachments;
                if ($attachments != null && $attachments->Count() > 0) {
                    foreach (array_keys($attachments->Instance()) as $key) {
                        $attachment =& $attachments->Get($key);
                        $tempname = $message->msg->IdMsg . '-' . $key . '_' . $attachment->GetTempName();
                        //$filename = ConvertUtils::ConvertEncoding($attachment->GetFilenameFromMime(), $GLOBALS[MailInputCharset], $message->account->GetUserCharset());
                        $filename = ConvertUtils::WMHtmlSpecialChars($attachment->GetFilenameFromMime());
                        $filesize = GetFriendlySize(strlen($attachment->MimePart->GetBinaryBody()));
                        $fs =& new FileSystem(INI_DIR . '/temp', $message->account->Email, $message->account->Id);
                        $attfolder =& new Folder($message->account->Id, -1, Session::val('attachtempdir', md5(session_id())));
                        $fs->SaveAttach($attachment, $attfolder, $tempname);
                        $this->attacmentsHtml .= '
<tr id="tr_' . ConvertUtils::AttributeQuote($tempname) . '"><td class="wm_attachment"><img src="./images/icons/' . GetAttachImg($filename) . '" />
<input type="hidden" name="attachments[' . ConvertUtils::AttributeQuote($tempname) . ']" value="' . ConvertUtils::AttributeQuote($filename) . '"> ' . $filename . '
 (' . $filesize . ') 						
<a href="#" id="' . ConvertUtils::AttributeQuote($tempname) . '" onClick="return  DeleteAttach(this.id);">' . JS_LANG_Delete . '</a></td></tr>';
                    }
                }
            }
        } else {
            $this->_pagebuilder->AddInitText('SetPriority(3);');
        }
        $signature = '';
        if ($withSignature) {
            if ($this->_proc->account->AllowDhtmlEditor) {
                $signature = $this->_proc->account->SignatureType == 0 ? nl2br($this->_proc->account->Signature) : $this->_proc->account->Signature;
                $signature = $isHtml ? $signature : strip_tags(nl2br($signature));
            } else {
                $signature = $this->_proc->account->SignatureType == 0 ? strip_tags($this->_proc->account->Signature) : strip_tags($this->_proc->account->Signature);
            }
        }
        $this->Body = $signature . $this->Body;
        if ($this->_proc->account->AllowDhtmlEditor) {
            $this->_pagebuilder->AddJSFile('class.html-editor.js');
            $setText = $isHtml ? 'HTMLEditor.SetHtml(mess);' : 'HTMLEditor.SetText(mess);';
            $this->_pagebuilder->AddJSText('
		function submitSaveMessage()
		{
			var hiddenkey = document.getElementById("ishtml");
			
			if (HTMLEditor._htmlMode) {
				plainEditor.value = HTMLEditor.GetText();
				hiddenkey.value = "1";
			} else {
				hiddenkey.value = "0";
			}
			if (bcc_mode == "hide")
			{
				document.getElementById("toBCC").value = "";
			}
			return true;
		}
		
		function EditAreaLoadHandler() { HTMLEditor.LoadEditArea();	}
		function CreateLinkHandler(url) { HTMLEditor.CreateLinkFromWindow(url); }
		function DesignModeOnHandler(rer) {
			HTMLEditor.Show();
			var mess = "' . ConvertUtils::ReBuildStringToJavaScript($this->Body, '"') . '";
			if (mess.length == 0) {
				mess = "<br />";
			}
			' . $setText . '
		}
				');
            $this->_pagebuilder->AddInitText('
		HTMLEditor = new CHtmlEditorField(true);
		HTMLEditor.SetPlainEditor(plainEditor, document.getElementById("mode_switcher"));
		HTMLEditor.Show();');
        } else {
            $this->_pagebuilder->AddJSText('
		function submitSaveMessage()
		{
			var hiddenkey = document.getElementById("ishtml");
			hiddenkey.value = "0";
			if (bcc_mode == "hide") {
				document.getElementById("toBCC").value = "";
			}
			return true;
		}
				');
        }
    }
Esempio n. 14
0
    /**
     * @return string
     */
    function MessageListTr()
    {
        $out = '';
        if (!$this->messageCollection) {
            return '';
        }
        $c = $this->messageCollection->Count();
        $stylewidth = array(array('', ' style="width: 21px; text-align: center;"'), array('', ' style="width: 20px;"'), array('', ' style="width: 20px;"'), array('', ' style="width: 150px;"'), array('', ' style="width: 140px;"'), array('', ' style="width: 48px;"'), array('', ' style="width: 148px;"'));
        $atemp_1 = $atemp_2 = '';
        if ($this->_proc->account->ViewMode == VIEW_MODE_WITHOUT_PREVIEW_PANE || $this->_proc->account->ViewMode == VIEW_MODE_WITHOUT_PREVIEW_PANE_NO_IMG) {
            $atemp_1 = '<a href="#">';
            $atemp_2 = '</a>';
        }
        for ($i = 0; $i < $c; $i++) {
            $msg =& $this->messageCollection->Get($i);
            if (!$msg) {
                continue;
            }
            $isRead = ($msg->Flags & MESSAGEFLAGS_Seen) == MESSAGEFLAGS_Seen ? 'true' : 'false';
            $flaggedImg = '';
            $handclass = $this->_proc->account->MailProtocol != MAILPROTOCOL_IMAP4 && $this->_proc->currentFolder && $this->_proc->currentFolder->SyncType == FOLDERSYNC_DirectMode ? '' : 'wm_control';
            if (($msg->Flags & MESSAGEFLAGS_Flagged) == MESSAGEFLAGS_Flagged) {
                $isFlagged = 'true';
                $flaggedImg = '<img class="' . $handclass . '" src="skins/' . $this->_pagebuilder->SkinName() . '/menu/flag.gif" />';
            } else {
                $isFlagged = 'false';
                $flaggedImg = '<img class="' . $handclass . '" src="skins/' . $this->_pagebuilder->SkinName() . '/menu/unflag.gif" />';
            }
            if ($msg->IdFolder == -1 && $this->folder && $this->folder->SyncType == FOLDERSYNC_DirectMode) {
                $msg->IdFolder = $this->folder->IdDb;
            }
            $isForwarded = ($msg->Flags & MESSAGEFLAGS_Forwarded) == MESSAGEFLAGS_Forwarded ? 'true' : 'false';
            $isDeleted = ($msg->Flags & MESSAGEFLAGS_Deleted) == MESSAGEFLAGS_Deleted ? 'true' : 'false';
            $isGrey = ($msg->Flags & MESSAGEFLAGS_Grayed) == MESSAGEFLAGS_Grayed ? 'true' : 'false';
            $isReplied = 'false';
            $date =& $msg->GetDate();
            $date->FormatString = $this->_proc->account->DefaultDateFormat;
            $date->TimeFormat = $this->_proc->account->DefaultTimeFormat;
            $sep = '-----';
            $char = $msg->Charset > -1 ? ConvertUtils::GetCodePageName($msg->Charset) : -1;
            $idString = $msg->IdMsg . $sep . $msg->Uid . $sep . $msg->IdFolder . $sep . $char . $sep;
            $folderName = $this->folder ? $this->folder->FullName : '';
            $this->_pagebuilder->AddInitText('messObj = {Read: ' . $isRead . ', Replied: ' . $isReplied . ', Forwarded: ' . $isForwarded . ', Flagged: ' . $isFlagged . ', Deleted: ' . $isDeleted . ', Gray: ' . $isGrey . ', Id: ' . (int) $msg->IdMsg . ', Uid: "' . ConvertUtils::ClearJavaScriptString($msg->Uid, '"') . '", FolderId: ' . $msg->IdFolder . ', FolderFullName: "' . ConvertUtils::ClearJavaScriptString($folderName, '"') . '", FromAddr: "", Subject: ""}');
            $this->_pagebuilder->AddInitText('InboxLines.AddLine(new CSelectionPart(document.getElementById("' . ConvertUtils::ClearJavaScriptString($idString, '"') . '"), "' . $this->_pagebuilder->SkinName() . '" , messObj));');
            $from = ConvertUtils::WMHtmlSpecialChars($msg->GetFromAsStringForSend());
            $to = ConvertUtils::WMHtmlSpecialChars($msg->GetAllRecipientsEmailsAsString(true));
            $subject = ConvertUtils::WMHtmlSpecialChars($msg->GetSubject(true));
            if (isset($this->_proc->sArray[SEARCH_ARRAY][S_TEXT]) && strlen($this->_proc->sArray[SEARCH_ARRAY][S_TEXT]) > 0) {
                $from = preg_replace('/' . preg_quote($this->_proc->sArray[SEARCH_ARRAY][S_TEXT]) . '/i', '<font>$0</font>', $from);
                $to = preg_replace('/' . preg_quote($this->_proc->sArray[SEARCH_ARRAY][S_TEXT]) . '/i', '<font>$0</font>', $to);
                $subject = preg_replace('/' . preg_quote($this->_proc->sArray[SEARCH_ARRAY][S_TEXT]) . '/i', '<font>$0</font>', $subject);
            }
            $subjectId = $i == 0 ? 'id="subject"' : '';
            $out .= '
			<tr onclick="CheckThisLine(event, this);" ondblclick="CheckThisLineDb(event, this);" id="' . ConvertUtils::AttributeQuote($idString) . '">
			<td' . $stylewidth[0][(int) ($i == 0)] . ' id="none"><input type="checkbox" /></td>
			<td' . $stylewidth[1][(int) ($i == 0)] . '>';
            $out .= (int) $msg->HasAttachments() == 1 ? '<img src="skins/' . $this->_pagebuilder->SkinName() . '/menu/attachment.gif" />' : '';
            $out .= '</td><td' . $stylewidth[2][(int) ($i == 0)] . '>' . $flaggedImg;
            $tempFromTo = $this->folder && $this->folder->ToFolder ? $to : $from;
            $out .= '</td><td' . $stylewidth[3][(int) ($i == 0)] . ' class="wm_inbox_from_subject"><nobr>' . $atemp_1 . $tempFromTo . $atemp_2 . '</nobr></td>
			<td' . $stylewidth[4][(int) ($i == 0)] . '><nobr>' . $date->GetFormattedDate($this->_proc->account->GetDefaultTimeOffset()) . '</nobr></td><td' . $stylewidth[5][(int) ($i == 0)] . '><nobr>' . GetFriendlySize($msg->Size) . '</nobr></td>
			<td' . $stylewidth[6][(int) ($i == 0)] . ' class="wm_inbox_from_subject" ' . $subjectId . '><nobr>' . $atemp_1 . $subject . $atemp_2 . '</nobr></td>
			</tr>';
        }
        if (isset($this->_proc->sArray[SEARCH_ARRAY]) && isset($this->_proc->sArray[SEARCH_ARRAY][S_TEXT]) && strlen($this->_proc->sArray[SEARCH_ARRAY][S_TEXT]) > 0 && $c == 0) {
            $out = '<tr><td colspan="6" style="width: 404px;"></td>';
            $out .= '<td style="width: 150px;" id="subject"></td></tr>
				<tr><td colspan="7"><div class="wm_inbox_info_message">' . InfoNoMessagesFound . '</div></td></tr>
				';
        } else {
            if ($c == 0) {
                $out = '<tr><td colspan="6" style="width: 404px;"></td>';
                $out .= '<td style="width: 150px;" id="subject"></td></tr>
				<tr><td colspan="7"><div class="wm_inbox_info_message">' . JS_LANG_InfoEmptyFolder . '</div></td></tr>
				';
            }
        }
        return $out;
    }
/**
 * Function that allows a quiz to be created or edited.
 */
function WPCW_showPage_ModifyQuiz_load()
{
    // Thickbox needed for random and quiz windows.
    add_thickbox();
    $page = new PageBuilder(true);
    $quizDetails = false;
    $adding = false;
    $quizID = false;
    // Check POST and GET
    if (isset($_GET['quiz_id'])) {
        $quizID = $_GET['quiz_id'] + 0;
    } else {
        if (isset($_POST['quiz_id'])) {
            $quizID = $_POST['quiz_id'] + 0;
        }
    }
    // Trying to edit a quiz
    if ($quizDetails = WPCW_quizzes_getQuizDetails($quizID, false, false, false)) {
        // Abort if quiz not found.
        if (!$quizDetails) {
            $page->showPageHeader(__('Edit Quiz/Survey', 'wp_courseware'), '70%', WPCW_icon_getPageIconURL());
            $page->showMessage(__('Sorry, but that quiz/survey could not be found.', 'wp_courseware'), true);
            $page->showPageFooter();
            return;
        } else {
            // Start form prolog - with quiz ID
            printf('<form method="POST" action="%s&quiz_id=%d" name="wpcw_quiz_details_modify" id="wpcw_quiz_details_modify">', admin_url('admin.php?page=WPCW_showPage_ModifyQuiz'), $quizDetails->quiz_id);
            $page->showPageHeader(__('Edit Quiz/Survey', 'wp_courseware'), '70%', WPCW_icon_getPageIconURL());
        }
    } else {
        // Start form prolog - no quiz ID
        printf('<form method="POST" action="%s" name="wpcw_quiz_details_modify" id="wpcw_quiz_details_modify">', admin_url('admin.php?page=WPCW_showPage_ModifyQuiz'));
        $page->showPageHeader(__('Add Quiz/Survey', 'wp_courseware'), '70%', WPCW_icon_getPageIconURL());
        $adding = true;
    }
    // Generate the tabs.
    $tabList = array('wpcw_section_break_quiz_general' => array('label' => __('General Settings', 'wp_courseware')), 'wpcw_section_break_quiz_logic' => array('label' => __('Quiz Behaviour Settings', 'wp_courseware')), 'wpcw_section_break_quiz_results' => array('label' => __('Result Settings', 'wp_courseware')), 'wpcw_section_break_quiz_custom_feedback' => array('label' => __('Custom Feedback', 'wp_courseware'), 'cssclass' => 'wpcw_quiz_only_tab'), 'wpcw_section_break_quiz_questions' => array('label' => __('Manage Questions', 'wp_courseware')));
    global $wpcwdb;
    $formDetails = array('wpcw_section_break_quiz_general' => array('type' => 'break', 'html' => WPCW_forms_createBreakHTML_tab(false)), 'quiz_title' => array('label' => __('Quiz Title', 'wp_courseware'), 'type' => 'text', 'required' => true, 'cssclass' => 'wpcw_quiz_title', 'desc' => __('The title of your quiz or survey. Your trainees will be able to see this quiz title.', 'wp_courseware'), 'validate' => array('type' => 'string', 'maxlen' => 150, 'minlen' => 1, 'regexp' => '/^[^<>]+$/', 'error' => __('Please specify a name for your quiz or survey, up to a maximum of 150 characters, just no angled brackets (&lt; or &gt;).', 'wp_courseware'))), 'quiz_desc' => array('label' => __('Quiz/Survey Description', 'wp_courseware'), 'type' => 'textarea', 'required' => false, 'cssclass' => 'wpcw_quiz_desc', 'rows' => 2, 'desc' => __('(Optional) The description of this quiz. Your trainees won\'t see this description. It\'s just for your reference.', 'wp_courseware'), 'validate' => array('type' => 'string', 'maxlen' => 5000, 'minlen' => 1, 'error' => __('Please limit the description of your quiz to 5000 characters.', 'wp_courseware'))), 'quiz_type' => array('label' => __('Quiz Type', 'wp_courseware'), 'type' => 'radio', 'required' => true, 'cssclass' => 'wpcw_quiz_type wpcw_quiz_type_hide_pass', 'data' => array('survey' => __('<b>Survey Mode</b> - No correct answers, just collect information.', 'wp_courseware'), 'quiz_block' => __('<b>Quiz Mode - Blocking</b> - require trainee to correctly answer questions before proceeding. Trainee must achieve <b>minimum pass mark</b> to progress to the next unit.', 'wp_courseware'), 'quiz_noblock' => __('<b>Quiz Mode - Non-blocking</b> - require trainee to answer a number of questions before proceeding, but allow them to progress to the next unit <b>regardless of their pass mark</b>.', 'wp_courseware'))), 'wpcw_section_break_quiz_logic' => array('type' => 'break', 'html' => WPCW_forms_createBreakHTML_tab(false)), 'quiz_pass_mark' => array('label' => __('Pass Mark', 'wp_courseware'), 'type' => 'select', 'required' => true, 'cssclass' => 'wpcw_quiz_block_only wpcw_quiz_only', 'data' => WPCW_quizzes_getPercentageList(__('-- Select a pass mark --', 'wp_courseware')), 'desc' => __('The minimum pass mark that your trainees need to achieve to progress on to the next unit.', 'wp_courseware')), 'quiz_attempts_allowed' => array('label' => __('Number of Attempts Allowed?', 'wp_courseware'), 'type' => 'select', 'required' => true, 'cssclass' => 'wpcw_quiz_block_only wpcw_quiz_only', 'data' => WPCW_quizzes_getAttemptList(), 'desc' => __('The maximum number of attempts that a trainee is given to complete a quiz for blocking quizzes.', 'wp_courseware')), 'quiz_show_survey_responses' => array('label' => __('Show Survey Responses?', 'wp_courseware'), 'type' => 'radio', 'required' => true, 'cssclass' => 'wpcw_survey_only', 'data' => array('show_responses' => __('<b>Show Responses</b> - Show the trainee their survey responses.', 'wp_courseware'), 'no_responses' => __('<b>No Responses</b> - Don\'t show the trainee their survey responses.', 'wp_courseware')), 'desc' => __('This setting allows you to choose whether or not you want students to be able to review their past survey responses when they return to units.', 'wp_courseware')), 'quiz_paginate_questions' => array('label' => __('Paginate Questions?', 'wp_courseware'), 'type' => 'radio', 'required' => true, 'cssclass' => 'wpcw_quiz_paginate_questions', 'data' => array('use_paging' => __('<b>Use Paging</b> - This setting will display quiz questions one at a time allowing students to progress through questions individually within a frame in your unit page.', 'wp_courseware'), 'no_paging' => __('<b>No Paging</b> - Don\'t use any paging. Show all quiz questions at once on the unit page.', 'wp_courseware')), 'suffix_subitems' => array('use_paging' => array('quiz_paginate_questions_settings' => array('type' => 'checkboxlist', 'required' => false, 'cssclass' => 'wpcw_quiz_paginate_questions_group', 'data' => array('allow_review_before_submission' => '<b>' . __('Allow Review Before Final Submission', 'wp_courseware') . '</b> - ' . __('If selected, students will be presented with an opportunity to review an editable list of all answers before final submission.', 'wp_courseware'), 'allow_students_to_answer_later' => '<b>' . __('Allow Students to Answer Later', 'wp_courseware') . '</b> - ' . __('If selected, the student will be able to click the "Answer Later" button and progress to the next question without answering. The question will be presented again at the end of the quiz.', 'wp_courseware'), 'allow_nav_previous_questions' => '<b>' . __('Allow Navigation to Previous Questions', 'wp_courseware') . '</b> - ' . __('If selected, a "Previous Question" button will be displayed, allowing students to freely navigate backwards and forwards through questions.', 'wp_courseware')))))), 'quiz_timer_mode' => array('label' => __('Set Time Limit for Quiz?', 'wp_courseware'), 'type' => 'radio', 'required' => true, 'cssclass' => 'wpcw_quiz_timer_mode wpcw_quiz_block_only', 'data' => array('use_timer' => __('<b>Specify a Quiz Time Limit</b> - Give the trainee a fixed amount of time to complete the quiz.', 'wp_courseware'), 'no_timer' => __('<b>No Time Limit</b> - the trainee can take as long as they wish to complete the quiz.', 'wp_courseware'))), 'quiz_timer_mode_limit' => array('label' => __('Time Limit (in minutes)', 'wp_courseware'), 'type' => 'text', 'required' => false, 'cssclass' => 'wpcw_quiz_timer_mode_limit wpcw_quiz_timer_mode_active_only wpcw_quiz_block_only', 'extrahtml' => __('Minutes', 'wp_courseware'), 'validate' => array('type' => 'number', 'max' => 1000, 'min' => 1, 'error' => 'Please choose time limit between 1 and 1000 minutes.')), 'wpcw_section_break_quiz_results' => array('type' => 'break', 'html' => WPCW_forms_createBreakHTML_tab(false)), 'quiz_show_answers' => array('label' => __('Show Answers?', 'wp_courseware'), 'type' => 'radio', 'required' => true, 'cssclass' => 'wpcw_quiz_show_answers wpcw_quiz_only', 'data' => array('show_answers' => __('<b>Show Answers</b> - Show the trainee the correct answers before they progress.', 'wp_courseware'), 'no_answers' => __('<b>No Answers</b> - Don\'t show the trainee any answers before they progress.', 'wp_courseware')), 'extrahtml' => '<div class="wpcw_msg_info wpcw_msg wpcw_msg_in_form wpcw_msg_error_no_answers_selected" style="display: none">' . __('If this option is selected, students will not be able to view correct or incorrect answers.', 'wp_courseware') . '</div>', 'suffix_subitems' => array('show_answers' => array('show_answers_settings' => array('type' => 'checkboxlist', 'required' => false, 'cssclass' => '', 'errormsg' => __('Please choose at least one option when showing correct answers.', 'wp_courseware'), 'data' => array('show_correct_answer' => '<b>' . __('Show correct answer', 'wp_courseware') . '</b> - ' . __('Show the trainee the correct answers before they progress.', 'wp_courseware'), 'show_user_answer' => '<b>' . __('Show user\'s answer', 'wp_courseware') . '</b> - ' . __('Show the trainee the answer they submitted before they progress.', 'wp_courseware'), 'show_explanation' => '<b>' . __('Show explanation', 'wp_courseware') . '</b> - ' . __('Show the trainee an explanation for the correct answer (if there is one).', 'wp_courseware'), 'mark_answers' => '<b>' . __('Mark Answers', 'wp_courseware') . '</b> - ' . __('This option will show correct answers with a green check mark, and incorrect answers with a red "X".', 'wp_courseware'), 'show_results_later' => '<b>' . __('Leave quiz results available for later viewing?', 'wp_courseware') . '</b> - ' . __('This setting allows you to choose whether or not you want students to be able to review their past quiz answers when they return to units.', 'wp_courseware')), 'extrahtml' => '<div class="wpcw_msg_error wpcw_msg wpcw_msg_in_form wpcw_msg_error_show_answers_none_selected" style="display: none">' . __('To make use of this showing answers setting, at least one of the above settings should be ticked. Otherwise, no answers are actually shown.', 'wp_courseware') . '</div>')))), 'quiz_results_by_tag' => array('label' => __('Show Results by Tag?', 'wp_courseware'), 'type' => 'checkbox', 'required' => false, 'extralabel' => __('<b>Display results by question tag</b> - In addition to the overall score, indicate a breakdown of the results for each question tag.', 'wp_courseware')), 'quiz_results_by_timer' => array('label' => __('Show Completion Time?', 'wp_courseware'), 'type' => 'checkbox', 'required' => false, 'cssclass' => 'wpcw_quiz_timer_mode_active_only wpcw_quiz_block_only', 'extralabel' => __('<b>Display completion time for timed quiz</b> - If the quiz has been timed, this option will display the student\'s total time used for completing the quiz.', 'wp_courseware')));
    $form = new RecordsForm($formDetails, $wpcwdb->quiz, 'quiz_id', false, 'wpcw_quiz_details_modify');
    $form->customFormErrorMsg = __('Sorry, but unfortunately there were some errors saving the quiz details. Please fix the errors and try again.', 'wp_courseware');
    $form->setAllTranslationStrings(WPCW_forms_getTranslationStrings());
    // Got to summary of quizzes
    $directionMsg = '<br/></br>' . sprintf(__('Do you want to return to the <a href="%s">quiz summary page</a>?', 'wp_courseware'), admin_url('admin.php?page=WPCW_showPage_QuizSummary'));
    // Override success messages
    $form->msg_record_created = __('Quiz details successfully created.', 'wp_courseware') . $directionMsg;
    $form->msg_record_updated = __('Quiz details successfully updated.', 'wp_courseware') . $directionMsg;
    $form->setPrimaryKeyValue($quizID);
    $form->setSaveButtonLabel(__('Save All Quiz Settings &amp; Questions', 'wp_courseware'));
    // Do default checking based on quiz type.
    $form->filterBeforeSaveFunction = 'WPCW_actions_quizzes_beforeQuizSaved';
    $form->afterSaveFunction = 'WPCW_actions_quizzes_afterQuizSaved';
    // Set defaults when creating a new one
    if ($adding) {
        $form->loadDefaults(array('quiz_pass_mark' => 50, 'quiz_type' => 'quiz_noblock', 'quiz_show_survey_responses' => 'no_responses', 'quiz_show_answers' => 'show_answers', 'show_answers_settings' => array('show_correct_answer' => 'on', 'show_user_answer' => 'on', 'show_explanation' => 'on', 'mark_answers' => 'on', 'show_results_later' => 'on'), 'quiz_paginate_questions' => 'no_paging', 'quiz_paginate_questions_settings' => array('allow_review_before_submission' => 'on', 'allow_students_to_answer_later' => 'on', 'allow_nav_previous_questions' => 'on'), 'quiz_timer_mode' => 'no_timer', 'quiz_timer_mode_limit' => '15', 'quiz_results_by_tag' => 'on', 'quiz_results_by_timer' => 'on'));
    }
    // Get the rendered form, extract the start and finish form tags so that
    // we can use the form across multiple panes, and submit other data such
    // as questions along with the quiz itself. We're doing this because the RecordsForm
    // object actually does a really good job, so we don't want to refactor to remove it.
    $formHTML = $form->getHTML();
    $formHTML = preg_replace('/^(\\s*?)(<form(.*?>))/', '', $formHTML);
    $formHTML = preg_replace('/<\\/form>(\\s*?)$/', '', $formHTML);
    // Need to move the submit button to before the closing form tag to allow it
    // to render on the page as expected after the questions drag-n-drop section.
    // Don't bother if we're not showing any questions yet though.
    $buttonHTML = false;
    if ($form->primaryKeyValue > 0) {
        $pattern = '/<p class="submit">(\\C*?)<\\/p>/';
        if (preg_match($pattern, $formHTML, $matches)) {
            // Found it, so add to variable to show later, and strip
            // it from the HTML so far.
            $buttonHTML = $matches[0];
            $formHTML = str_replace($buttonHTML, false, $formHTML);
        }
    }
    // Not got any questions to show yet, so hide questions tab.
    if ($form->primaryKeyValue <= 0) {
        unset($tabList['wpcw_section_break_quiz_questions']);
        unset($tabList['wpcw_section_break_quiz_custom_feedback']);
    }
    // Show a placeholder for an error message that may occur within tabs.
    printf('<div class="wpcw_msg wpcw_msg_error wpcw_section_error_within_tabs">%s</div>', __('Unfortunately, there are a few missing details that need to be added before this quiz can be saved. Please resolve them and try again.', 'wp_courseware'));
    // Render the tabs
    echo WPCW_tabs_generateTabHeader($tabList, 'wpcw_quizzes_tabs');
    // The main quiz settings
    echo $formHTML;
    // Try to see if we've got an ID having saved the form from a first add
    // or we're editing the form
    if ($form->primaryKeyValue > 0) {
        $quizID = $form->primaryKeyValue;
        // Top for jumps.
        printf('<a name="top"></a>');
        // ### 1) Custom Feedback Messages
        printf('<div class="wpcw_form_break_tab"></div>');
        printf('<div class="form-table" id="wpcw_section_break_quiz_custom_feedback">');
        WPCW_showPage_customFeedback_showEditForms($quizID, $page);
        printf('</div>');
        // ### 2) Question Settings
        printf('<div class="wpcw_form_break_tab"></div>');
        printf('<div class="form-table" id="wpcw_section_break_quiz_questions">');
        WPCW_showPage_ModifyQuiz_showQuestionEntryForms($quizID, $page);
        printf('</div>');
    }
    // Reshow the button here
    echo $buttonHTML;
    // The closing form tag
    echo '</form>';
    // .wpcw_tab_wrapper
    echo '</div>';
    // The thickboxes for the page
    WPCW_showPage_thickbox_questionPool();
    WPCW_showPage_thickbox_randomQuestion();
    $page->showPageFooter();
}
Esempio n. 16
0
 /**
  * Page that shows the overview of mapping for the levels to courses.
  * @param PageBuilder $page The current page object.
  */
 private function showMembershipMappingLevels_overview($page)
 {
     // Handle the detection of the membership plugin before doing anything else.
     if (!$this->found_membershipTool()) {
         $page->showPageFooter();
         return;
     }
     // Try to show the level data
     $levelData = $this->getMembershipLevels_cached();
     if ($levelData) {
         // Create the table to show the data
         $table = new TableBuilder();
         $table->attributes = array('class' => 'wpcw_tbl widefat', 'id' => 'wpcw_members_tbl');
         $col = new TableColumn(__('Level ID', 'wp_courseware'), 'wpcw_members_id');
         $table->addColumn($col);
         $col = new TableColumn(__('Level Name', 'wp_courseware'), 'wpcw_members_name');
         $table->addColumn($col);
         $col = new TableColumn(__('Users at this level can access:', 'wp_courseware'), 'wpcw_members_levels');
         $table->addColumn($col);
         $col = new TableColumn(__('Actions', 'wp_courseware'), 'wpcw_members_actions');
         $table->addColumn($col);
         $odd = false;
         // Work out the base URL for the overview page
         $baseURL = admin_url('admin.php?page=' . $this->extensionID);
         // The list of courses that are currently on the system.
         $courses = WPCW_courses_getCourseList(false);
         // Add actual level data
         foreach ($levelData as $id => $levelDatum) {
             $data = array();
             $data['wpcw_members_id'] = $levelDatum['id'];
             $data['wpcw_members_name'] = $levelDatum['name'];
             // Get list of courses already associated with level.
             $courseListInDB = $this->getCourseAccessListForLevel($levelDatum['id']);
             if ($courses) {
                 $data['wpcw_members_levels'] = '<ul class="wpcw_tickitems">';
                 // Show which courses will be added to users created at this level.
                 foreach ($courses as $courseID => $courseName) {
                     $data['wpcw_members_levels'] .= sprintf('<li class="wpcw_%s">%s</li>', isset($courseListInDB[$courseID]) ? 'enabled' : 'disabled', $courseName);
                 }
                 $data['wpcw_members_levels'] .= '</ul>';
             } else {
                 $data['wpcw_members_levels'] = __('There are no courses yet.', 'wp_courseware');
             }
             // Buttons to edit the permissions
             $data['wpcw_members_actions'] = sprintf('<a href="%s&level_id=%s" class="button-secondary">%s</a>', $baseURL, $levelDatum['id'], __('Edit Course Access Settings', 'wp_courseware'));
             $odd = !$odd;
             $table->addRow($data, $odd ? 'alternate' : '');
         }
         echo $table->toString();
     } else {
         $page->showMessage(sprintf(__('No membership levels were found for %s.', 'wp_courseware'), $this->extensionName), true);
     }
 }
/** 
 * Page where the site owner can choose which courses a user is allowed to access.
 */
function WPCW_showPage_UserCourseAccess_load()
{
    global $wpcwdb, $wpdb;
    $wpdb->show_errors();
    $page = new PageBuilder(false);
    $page->showPageHeader(__('Update User Course Access Permissions', 'wp_courseware'), '75%', WPCW_icon_getPageIconURL());
    // Check passed user ID is valid
    $userID = WPCW_arrays_getValue($_GET, 'user_id');
    $userDetails = get_userdata($userID);
    if (!$userDetails) {
        $page->showMessage(__('Sorry, but that user could not be found.', 'wp_courseware'), true);
        $page->showPageFooter();
        return false;
    }
    printf(__('<p>Here you can change which courses the user <b>%s</b> (Username: <b>%s</b>) can access.</p>', 'wp_courseware'), $userDetails->data->display_name, $userDetails->data->user_login);
    // Check to see if anything has been submitted?
    if (isset($_POST['wpcw_course_user_access'])) {
        $subUserID = WPCW_arrays_getValue($_POST, 'user_id') + 0;
        $userSubDetails = get_userdata($subUserID);
        // Check that user ID is valid, and that it matches user we're editing.
        if (!$userSubDetails || $subUserID != $userID) {
            $page->showMessage(__('Sorry, but that user could not be found. The changes were not saved.', 'wp_courseware'), true);
        } else {
            // Get list of courses that user is allowed to access from the submitted values.
            $courseAccessIDs = array();
            foreach ($_POST as $key => $value) {
                // Check for course ID selection
                if (preg_match('/^wpcw_course_(\\d+)$/', $key, $matches)) {
                    $courseAccessIDs[] = $matches[1];
                }
            }
            // Sync courses that the user is allowed to access
            WPCW_courses_syncUserAccess($subUserID, $courseAccessIDs, 'sync');
            // Final success message
            $message = sprintf(__('The courses for user <em>%s</em> have now been updated.', 'wp_courseware'), $userDetails->data->display_name);
            $page->showMessage($message, false);
        }
    }
    $SQL = "SELECT * \n\t\t\tFROM {$wpcwdb->courses}\n\t\t\tORDER BY course_title ASC \n\t\t\t";
    $courses = $wpdb->get_results($SQL);
    if ($courses) {
        $tbl = new TableBuilder();
        $tbl->attributes = array('id' => 'wpcw_tbl_course_access_summary', 'class' => 'widefat wpcw_tbl');
        $tblCol = new TableColumn(__('Allowed Access', 'wp_courseware'), 'allowed_access');
        $tblCol->cellClass = "allowed_access";
        $tbl->addColumn($tblCol);
        $tblCol = new TableColumn(__('Course Title', 'wp_courseware'), 'course_title');
        $tblCol->cellClass = "course_title";
        $tbl->addColumn($tblCol);
        $tblCol = new TableColumn(__('Description', 'wp_courseware'), 'course_desc');
        $tblCol->cellClass = "course_desc";
        $tbl->addColumn($tblCol);
        // Format row data and show it.
        $odd = false;
        foreach ($courses as $course) {
            $data = array();
            // Basic details
            $data['course_desc'] = $course->course_desc;
            $editURL = admin_url('admin.php?page=WPCW_showPage_ModifyCourse&course_id=' . $course->course_id);
            $data['course_title'] = sprintf('<a href="%s">%s</a>', $editURL, $course->course_title);
            // Checkbox if enabled or not
            $userAccess = WPCW_courses_canUserAccessCourse($course->course_id, $userID);
            $checkedHTML = $userAccess ? 'checked="checked"' : '';
            $data['allowed_access'] = sprintf('<input type="checkbox" name="wpcw_course_%d" %s/>', $course->course_id, $checkedHTML);
            // Odd/Even row colouring.
            $odd = !$odd;
            $tbl->addRow($data, $odd ? 'alternate' : '');
        }
        // Create a form so user can update access.
        ?>
		<form action="<?php 
        str_replace('%7E', '~', $_SERVER['REQUEST_URI']);
        ?>
" method="post">
			<?php 
        // Finally show table
        echo $tbl->toString();
        ?>
			<input type="hidden" name="user_id" value="<?php 
        echo $userID;
        ?>
"> 
			<input type="submit" class="button-primary" name="wpcw_course_user_access" value="<?php 
        _e('Save Changes', 'wp_courseware');
        ?>
" />
		</form>
		<?php 
    } else {
        printf('<p>%s</p>', __('There are currently no courses to show. Why not create one?', 'wp_courseware'));
    }
    $page->showPageFooter();
}
Esempio n. 18
0
/**
 * Function that allows a question to be edited.
 */
function WPCW_showPage_ModifyQuestion_load()
{
    $page = new PageBuilder(true);
    $page->showPageHeader(__('Edit Single Question', 'wp_courseware'), '70%', WPCW_icon_getPageIconURL());
    $questionID = false;
    // Check POST and GET
    if (isset($_GET['question_id'])) {
        $questionID = $_GET['question_id'] + 0;
    } else {
        if (isset($_POST['question_id'])) {
            $questionID = $_POST['question_id'] + 0;
        }
    }
    // Trying to edit a question
    $questionDetails = WPCW_questions_getQuestionDetails($questionID, true);
    // Abort if question not found.
    if (!$questionDetails) {
        $page->showMessage(__('Sorry, but that question could not be found.', 'wp_courseware'), true);
        $page->showPageFooter();
        return;
    }
    // See if the question has been submitted for saving.
    if ('true' == WPCW_arrays_getValue($_POST, 'question_save_mode')) {
        WPCW_handler_questions_processSave(false, true);
        $page->showMessage(__('Question successfully updated.', 'wp_courseware'));
        // Assume save has happened, so reload the settings.
        $questionDetails = WPCW_questions_getQuestionDetails($questionID, true);
    }
    // Manually set the order to zero, as not needed for ordering in this context.
    $questionDetails->question_order = 0;
    switch ($questionDetails->question_type) {
        case 'multi':
            $quizObj = new WPCW_quiz_MultipleChoice($questionDetails);
            break;
        case 'truefalse':
            $quizObj = new WPCW_quiz_TrueFalse($questionDetails);
            break;
        case 'open':
            $quizObj = new WPCW_quiz_OpenEntry($questionDetails);
            break;
        case 'upload':
            $quizObj = new WPCW_quiz_FileUpload($questionDetails);
            break;
        default:
            die(__('Unknown quiz type: ', 'wp_courseware') . $questionDetails->question_type);
            break;
    }
    $quizObj->showErrors = true;
    $quizObj->needCorrectAnswers = true;
    $quizObj->hideDragActions = true;
    // #wpcw_quiz_details_questions = needed for media uploader
    // .wpcw_question_holder_static = needed for wrapping the question using existing HTML.
    printf('<div id="wpcw_quiz_details_questions"><ul class="wpcw_question_holder_static">');
    // Create form wrapper, so that we can save this question.
    printf('<form method="POST" action="%s?page=WPCW_showPage_ModifyQuestion&question_id=%d" />', admin_url('admin.php'), $questionDetails->question_id);
    // Question hidden fields
    printf('<input name="question_id" type="hidden" value="%d" />', $questionDetails->question_id);
    printf('<input name="question_save_mode" type="hidden" value="true" />');
    // Show the quiz so that it can be edited. We're re-using the code we have for editing questions,
    // to save creating any special form edit code.
    echo $quizObj->editForm_toString();
    // Save and return buttons.
    printf('<div class="wpcw_button_group"><br/>');
    printf('<a href="%s?page=WPCW_showPage_QuestionPool" class="button-secondary">%s</a>&nbsp;&nbsp;', admin_url('admin.php'), __('&laquo; Return to Question Pool', 'wp_courseware'));
    printf('<input type="submit" class="button-primary" value="%s" />', __('Save Question Details', 'wp_courseware'));
    printf('</div>');
    printf('</form>');
    printf('</ul></div>');
    $page->showPageFooter();
}
Esempio n. 19
0
 /**
  * Регистрация страниц SDK
  */
 private function registerSdkFoldings()
 {
     $this->register(PopupPagesManager::inst());
     $this->register(PluginsManager::inst());
     $this->register(TimeLineManager::inst());
     $this->register(UserPointsManager::inst());
     $this->register(StockManager::inst());
     $this->register(HelpManager::inst());
     $this->register(EmailManager::inst());
     $this->register(PSForm::inst());
     $this->register(DialogManager::inst());
     $this->register(PageBuilder::inst());
     //Библиотеки
     $this->register(PoetsManager::inst());
     $this->register(ScientistsManager::inst());
     //Админские страницы
     $this->register(APagesResources::inst());
 }
Esempio n. 20
0
/**
 * @param PageBuilder $pagebuilder
 * @param int $contact_id
 * @param bool $isNew
 * @return string
 */
function WriteContactEdit(&$pagebuilder, $contact_id, $isNew = false)
{
    $out = '';
    $isCorrect = false;
    $jsIsNew = $isNew ? 'true' : 'false';
    $pagebuilder->AddJSText('

function dolocation(idurl) 
{
	var url = document.getElementById(idurl);
	if (url && url.value.length > 2) {
		OpenURL(url.value);
	}
}

function MessageToMail(email)
{
	if (!email) {
		return false;
	}
	var form = CreateChildWithAttrs(document.body, "form", [["action", "' . BASEFILE . '?' . SCREEN . '=' . SCREEN_NEWOREDIT . '"], ["method", "POST"]]);
	CreateChildWithAttrs(form, "input", [["type", "hidden"], ["name", "mailto"], ["value", email]]);
	form.submit();
}

function submitContactForm()
{
	var result = false;
	if (newContact) { 
		result = newContact.SubmitContact();
	}
	if (!result) {
		alert(Lang.WarningContactNotComplete);
	}
	return result;
} 

function DoCancle()
{
	if (' . $jsIsNew . ') {
		document.location = "' . BASEFILE . '?' . SCREEN . '=' . SCREEN_CONTACTS . '";
	} else {
		document.location = "' . BASEFILE . '?' . SCREEN . '=' . SCREEN_CONTACTS . '&' . CONTACT_MODE . '=' . C_VIEW . '&' . CONTACT_ID . '=' . $contact_id . '";
	}
}
	');
    if ($isNew) {
        $contact = new AddressBookRecord();
        $contact->PrimaryEmail = 0;
        $groupsArray = array();
        if (Post::val('cdata') == 1) {
            $contact->FullName = Post::val('cfullname', '');
            $contact->HomeEmail = Post::val('cemail', '');
        }
    } else {
        $contact =& $pagebuilder->_proc->db->SelectAddressBookRecord($contact_id);
        $groupsArray =& $pagebuilder->_proc->db->SelectAddressGroupContact($contact_id);
    }
    $allGroups =& $pagebuilder->_proc->db->SelectUserAddressGroupNames();
    $skinName = $pagebuilder->SkinName();
    if ($contact && is_object($contact)) {
        $isCorrect = true;
    }
    if ($isCorrect) {
        $pagebuilder->AddInitText($contact->isOpen() ? 'var isOpenContact = true;' : 'var isOpenContact = false;');
        $data = array();
        $data = @get_object_vars($contact);
        foreach ($data as $key => $value) {
            $data[$key] = $value && strlen($value) > 0 ? array('', $value) : array(' class="wm_hide"', '');
        }
        $Birthday[0] = $data['BirthdayDay'][1] || $data['BirthdayMonth'][1] || $data['BirthdayYear'][1] ? '' : ' class="wm_hide"';
        $Birthday[1] = GetBirthDay($data['BirthdayDay'][1], $data['BirthdayMonth'][1], $data['BirthdayYear'][1]);
        $Email = array('', '');
        switch ($contact->PrimaryEmail) {
            case PRIMARYEMAIL_Home:
                $Email[1] = $contact->HomeEmail;
                break;
            case PRIMARYEMAIL_Business:
                $Email[1] = $contact->BusinessEmail;
                break;
            case PRIMARYEMAIL_Other:
                $Email[1] = $contact->OtherEmail;
                break;
        }
        $Email[0] = $Email[1] ? '' : ' class="wm_hide"';
        $class_00 = $data['HomeEmail'][1] || $data['HomeStreet'][1] || $data['HomeCity'][1] || $data['HomeFax'][1] || $data['HomeState'][1] || $data['HomePhone'][1] || $data['HomeZip'][1] || $data['HomeMobile'][1] || $data['HomeCountry'][1] || $data['HomeWeb'][1];
        $class_00 = $class_00 ? ' class="wm_contacts_view"' : ' class="wm_hide"';
        $class_01 = $data['HomeCity'][1] || $data['HomeFax'][1] ? '' : ' class="wm_hide"';
        $data['HomeCity'][0] = $data['HomeCity'][1] != '' ? ' class="wm_contacts_view_title"' : ' class="wm_hide"';
        $data['HomeCity'][2] = $data['HomeCity'][1] != '' ? '' : ' class="wm_hide"';
        $data['HomeFax'][0] = $data['HomeFax'][1] != '' ? ' class="wm_contacts_view_title"' : ' class="wm_hide"';
        $data['HomeFax'][2] = $data['HomeFax'][1] != '' ? '' : ' class="wm_hide"';
        $class_02 = $data['HomeState'][1] || $data['HomePhone'][1] ? '' : ' class="wm_hide"';
        $data['HomeState'][0] = $data['HomeState'][1] != '' ? ' class="wm_contacts_view_title"' : ' class="wm_hide"';
        $data['HomeState'][2] = $data['HomeState'][1] != '' ? '' : ' class="wm_hide"';
        $data['HomePhone'][0] = $data['HomePhone'][1] != '' ? ' class="wm_contacts_view_title"' : ' class="wm_hide"';
        $data['HomePhone'][2] = $data['HomePhone'][1] != '' ? '' : ' class="wm_hide"';
        $class_03 = $data['HomeZip'][1] || $data['HomeMobile'][1] ? '' : ' class="wm_hide"';
        $data['HomeZip'][0] = $data['HomeZip'][1] != '' ? ' class="wm_contacts_view_title"' : ' class="wm_hide"';
        $data['HomeZip'][2] = $data['HomeZip'][1] != '' ? '' : ' class="wm_hide"';
        $data['HomeMobile'][0] = $data['HomeMobile'][1] != '' ? ' class="wm_contacts_view_title"' : ' class="wm_hide"';
        $data['HomeMobile'][2] = $data['HomeMobile'][1] != '' ? '' : ' class="wm_hide"';
        $class_10 = $data['BusinessCompany'][1] || $data['BusinessJobTitle'][1] || $data['BusinessDepartment'][1] || $data['BusinessOffice'][1] || $data['BusinessCity'][1] || $data['BusinessFax'][1] || $data['BusinessState'][1] || $data['BusinessPhone'][1] || $data['BusinessZip'][1] || $data['BusinessCountry'][1] || $data['BusinessEmail'][1] || $data['BusinessStreet'][1] || $data['BusinessWeb'][1];
        $class_10 = $class_10 ? ' class="wm_contacts_view"' : ' class="wm_hide"';
        $class_11 = $data['BusinessCompany'][1] || $data['BusinessJobTitle'][1] ? '' : ' class="wm_hide"';
        $data['BusinessCompany'][0] = $data['BusinessCompany'][1] != '' ? ' class="wm_contacts_view_title"' : ' class="wm_hide"';
        $data['BusinessCompany'][2] = $data['BusinessCompany'][1] != '' ? '' : ' class="wm_hide"';
        $data['BusinessJobTitle'][0] = $data['BusinessJobTitle'][1] != '' ? ' class="wm_contacts_view_title"' : ' class="wm_hide"';
        $data['BusinessJobTitle'][2] = $data['BusinessJobTitle'][1] != '' ? '' : ' class="wm_hide"';
        $class_12 = $data['BusinessDepartment'][1] || $data['BusinessOffice'][1] ? '' : ' class="wm_hide"';
        $data['BusinessDepartment'][0] = $data['BusinessDepartment'][1] != '' ? ' class="wm_contacts_view_title"' : ' class="wm_hide"';
        $data['BusinessDepartment'][2] = $data['BusinessDepartment'][1] != '' ? '' : ' class="wm_hide"';
        $data['BusinessOffice'][0] = $data['BusinessOffice'][1] != '' ? ' class="wm_contacts_view_title"' : ' class="wm_hide"';
        $data['BusinessOffice'][2] = $data['BusinessOffice'][1] != '' ? '' : ' class="wm_hide"';
        $class_13 = $data['BusinessCity'][1] || $data['BusinessFax'][1] ? '' : ' class="wm_hide"';
        $data['BusinessCity'][0] = $data['BusinessCity'][1] != '' ? ' class="wm_contacts_view_title"' : ' class="wm_hide"';
        $data['BusinessCity'][2] = $data['BusinessCity'][1] != '' ? '' : ' class="wm_hide"';
        $data['BusinessFax'][0] = $data['BusinessFax'][1] != '' ? ' class="wm_contacts_view_title"' : ' class="wm_hide"';
        $data['BusinessFax'][2] = $data['BusinessFax'][1] != '' ? '' : ' class="wm_hide"';
        $class_14 = $data['BusinessState'][1] || $data['BusinessPhone'][1] ? '' : ' class="wm_hide"';
        $data['BusinessState'][0] = $data['BusinessState'][1] != '' ? ' class="wm_contacts_view_title"' : ' class="wm_hide"';
        $data['BusinessState'][2] = $data['BusinessState'][1] != '' ? '' : ' class="wm_hide"';
        $data['BusinessPhone'][0] = $data['BusinessPhone'][1] != '' ? ' class="wm_contacts_view_title"' : ' class="wm_hide"';
        $data['BusinessPhone'][2] = $data['BusinessPhone'][1] != '' ? '' : ' class="wm_hide"';
        $class_15 = $data['BusinessZip'][1] || $data['BusinessCountry'][1] ? '' : ' class="wm_hide"';
        $data['BusinessZip'][0] = $data['BusinessZip'][1] != '' ? ' class="wm_contacts_view_title"' : ' class="wm_hide"';
        $data['BusinessZip'][2] = $data['BusinessZip'][1] != '' ? '' : ' class="wm_hide"';
        $data['BusinessCountry'][0] = $data['BusinessCountry'][1] != '' ? ' class="wm_contacts_view_title"' : ' class="wm_hide"';
        $data['BusinessCountry'][2] = $data['BusinessCountry'][1] != '' ? '' : ' class="wm_hide"';
        $class_20 = $data['OtherEmail'][1] || $data['Notes'][1] || $Birthday[1];
        $class_20 = $class_20 ? ' class="wm_contacts_view"' : ' class="wm_hide"';
        $daysSelect = '';
        for ($i = 1; $i < 32; $i++) {
            $daysSelect .= $data['BirthdayDay'][1] == $i ? '<option value="' . $i . '" selected="selected">' . $i . '</option>' . "\r\n" : '<option value="' . $i . '">' . $i . '</option>' . "\r\n";
        }
        $selectedArray = array('', '', '', '', '', '', '', '', '', '', '', '', '', '');
        if (isset($data['BirthdayMonth'][1]) && $data['BirthdayMonth'][1] > 0 && $data['BirthdayMonth'][1] < 13) {
            $selectedArray[(int) $data['BirthdayMonth'][1]] = ' selected="selected"';
        }
        $monthsSelect = '<option value="1"' . $selectedArray[1] . '>' . JS_LANG_January . '</option>
						<option value="2"' . $selectedArray[2] . '>' . JS_LANG_February . '</option>
						<option value="3"' . $selectedArray[3] . '>' . JS_LANG_March . '</option>
						<option value="4"' . $selectedArray[4] . '>' . JS_LANG_April . '</option>
						<option value="5"' . $selectedArray[5] . '>' . JS_LANG_May . '</option>
						<option value="6"' . $selectedArray[6] . '>' . JS_LANG_June . '</option>
						<option value="7"' . $selectedArray[7] . '>' . JS_LANG_July . '</option>
						<option value="8"' . $selectedArray[8] . '>' . JS_LANG_August . '</option>
						<option value="9"' . $selectedArray[9] . '>' . JS_LANG_September . '</option>
						<option value="10"' . $selectedArray[10] . '>' . JS_LANG_October . '</option>
						<option value="11"' . $selectedArray[11] . '>' . JS_LANG_November . '</option>
						<option value="12"' . $selectedArray[12] . '>' . JS_LANG_December . '</option>';
        $yearsSelect = '';
        $lastyear = (int) date('Y', time()) > 1900 ? (int) date('Y', time()) : 2008;
        for ($i = $lastyear; $i > 1899; $i--) {
            $yearsSelect .= $data['BirthdayYear'][1] == $i ? '<option value="' . $i . '" selected="selected">' . $i . '</option>' . "\r\n" : '<option value="' . $i . '">' . $i . '</option>' . "\r\n";
        }
        $groupsHtml = '';
        if ($groupsArray && count($groupsArray) > 0) {
            $groupsHtml = '<table class="wm_contacts_view">
									<tr>
									<td class="wm_contacts_view_title wm_contacts_section_name">' . JS_LANG_Groups . ':</td>';
            $k = 0;
            $cnt = count($groupsArray);
            foreach ($groupsArray as $key => $value) {
                $k++;
                $tempstr = $cnt > $k ? ',' : '';
                $groupsHtml .= '<td class="wm_contacts_groups"><a href="' . BASEFILE . '?' . CONTACT_MODE . '=' . G_VIEW . '&' . CONTACT_ID . '=' . $key . '">' . $value . '</a>' . $tempstr . '</td>' . "\r\n";
            }
            $groupsHtml .= '</tr></table>';
        }
        $groupsHtml2 = '';
        if (count($allGroups) > 0) {
            $groupsHtml2 = '
							<table class="wm_contacts_tab" onclick="ChangeTabVisibility(\'street_addresses\');">
									<tr>
										<td>
											<span class="wm_contacts_tab_name">
												' . JS_LANG_Groups . '
											</span>
											<span class="wm_contacts_tab_mode">
												<img id="button_street_addresses" src="skins/' . $skinName . '/menu/arrow_down.gif" />
											</span>
										</td>
									</tr>
								</table>
								<table class="wm_hide" id="street_addresses">
									<tr><td>';
            foreach ($allGroups as $id => $name) {
                $inGroup = key_exists($id, $groupsArray);
                $inGroup = $inGroup ? 'checked="checked"' : '';
                $groupsHtml2 .= '<input id="inp_g_' . $id . '" class="wm_checkbox" ' . $inGroup . ' type="checkbox" value="' . $id . '" name="groupsIds[]"/>
					<label for="inp_g_' . $id . '">' . $name . '</label><br />';
            }
            $groupsHtml2 .= '
									</td></tr>
								</table>';
        }
        $useFrName = $contact->UseFriendlyName || $isNew ? ' checked="checked"' : '';
        $isNewHidden = $isNew ? '1' : '0';
        $out .= '<form action="' . ACTIONFILE . '?action=update&req=contact" method="POST" onsubmit="return submitContactForm()">
							<input type="hidden" name="isNewContact" value="' . $isNewHidden . '" />
							<input type="hidden" name="contactId" value="' . $contact_id . '" />
							<div id="viewTbl">
								<table class="wm_contacts_view">
									<tr' . $data['FullName'][0] . '>
										<td class="wm_contacts_view_title">' . JS_LANG_Name . ':</td>
										<td class="wm_contacts_name">' . ConvertUtils::WMHtmlSpecialChars($data['FullName'][1]) . '</td>
									</tr>
									<tr' . $Email[0] . '>
										<td class="wm_contacts_view_title">' . JS_LANG_Email . ':</td>
										<td class="wm_contacts_email"><a href="#" onclick="return MessageToMail(\'' . ConvertUtils::AttributeQuote(ConvertUtils::ClearJavaScriptString(ConvertUtils::WMHtmlSpecialChars($Email[1]), '\'')) . '\')">' . ConvertUtils::WMHtmlSpecialChars($Email[1]) . '</a></td>
									</tr>
								</table>
								<table' . $class_00 . '>
									<tr>
										<td class="wm_contacts_section_name" colspan="4">' . JS_LANG_Home . '</td>
									</tr>
									<tr' . $data['HomeEmail'][0] . '>
										<td class="wm_contacts_view_title">' . JS_LANG_PersonalEmail . ':</td>
										<td colspan="3">
											<a href="#" onclick="return MessageToMail(\'' . ConvertUtils::AttributeQuote(ConvertUtils::ClearJavaScriptString(ConvertUtils::WMHtmlSpecialChars($data['HomeEmail'][1]), '\'')) . '\')">' . ConvertUtils::WMHtmlSpecialChars($data['HomeEmail'][1]) . '</a>
										</td>
									</tr>
									<tr' . $data['HomeStreet'][0] . '>
										<td class="wm_contacts_view_title">' . JS_LANG_StreetAddress . ':</td>
										<td colspan="3">' . ConvertUtils::WMHtmlSpecialChars($data['HomeStreet'][1]) . '</td>
									</tr>
									<tr' . $class_01 . '>
										<td' . $data['HomeCity'][0] . '>' . JS_LANG_City . ':</td>
										<td' . $data['HomeCity'][2] . '>' . ConvertUtils::WMHtmlSpecialChars($data['HomeCity'][1]) . '</td>
										<td' . $data['HomeFax'][0] . '>' . JS_LANG_Fax . ':</td>
										<td' . $data['HomeFax'][2] . '>' . ConvertUtils::WMHtmlSpecialChars($data['HomeFax'][1]) . '</td>
									</tr>
									<tr' . $class_02 . '>
										<td' . $data['HomeState'][0] . '>' . JS_LANG_StateProvince . ':</td>
										<td' . $data['HomeState'][2] . '>' . ConvertUtils::WMHtmlSpecialChars($data['HomeState'][1]) . '</td>
										<td' . $data['HomePhone'][0] . '>' . JS_LANG_Phone . ':</td>
										<td' . $data['HomePhone'][2] . '>' . ConvertUtils::WMHtmlSpecialChars($data['HomePhone'][1]) . '</td>
									</tr>
									<tr' . $class_03 . '>
										<td' . $data['HomeZip'][0] . '>' . JS_LANG_ZipCode . ':</td>
										<td' . $data['HomeZip'][2] . '>' . ConvertUtils::WMHtmlSpecialChars($data['HomeZip'][1]) . '</td>
										<td' . $data['HomeMobile'][0] . '>' . JS_LANG_Mobile . ':</td>
										<td' . $data['HomeMobile'][2] . '>' . ConvertUtils::WMHtmlSpecialChars($data['HomeMobile'][1]) . '</td>
									</tr>
									<tr' . $data['HomeCountry'][0] . '>
										<td class="wm_contacts_view_title">' . JS_LANG_CountryRegion . ':</td>
										<td colspan="3">
											' . ConvertUtils::WMHtmlSpecialChars($data['HomeCountry'][1]) . '
										</td>
									</tr>
									<tr' . $data['HomeWeb'][0] . '>
										<td class="wm_contacts_view_title">' . JS_LANG_WebPage . ':</td>
										<td colspan="3">
											' . ConvertUtils::WMHtmlSpecialChars($data['HomeWeb'][1]) . '
										</td>
									</tr>
								</table>
								<table' . $class_10 . '>
									<tr>
										<td class="wm_contacts_section_name" colspan="4">' . JS_LANG_Business . '</td>
									</tr>
									<tr' . $data['BusinessEmail'][0] . '>
										<td class="wm_contacts_view_title">' . JS_LANG_BusinessEmail . ':</td>
										<td colspan="3">
											<a href="#" onclick="return MessageToMail(\'' . ConvertUtils::AttributeQuote(ConvertUtils::ClearJavaScriptString(ConvertUtils::WMHtmlSpecialChars($data['BusinessEmail'][1]), '\'')) . '\')">' . ConvertUtils::WMHtmlSpecialChars($data['BusinessEmail'][1]) . '</a>
										</td>
									</tr>
									<tr' . $class_11 . '>
										<td' . $data['BusinessCompany'][0] . '>' . JS_LANG_Company . ':</td>
										<td' . $data['BusinessCompany'][2] . '>' . ConvertUtils::WMHtmlSpecialChars($data['BusinessCompany'][1]) . '</td>
										<td' . $data['BusinessJobTitle'][0] . '">' . JS_LANG_JobTitle . ':</td>
										<td' . $data['BusinessJobTitle'][2] . '>' . ConvertUtils::WMHtmlSpecialChars($data['BusinessJobTitle'][1]) . '</td>
									</tr>
									<tr' . $class_12 . '>
										<td' . $data['BusinessDepartment'][0] . '>' . JS_LANG_Department . ':</td>
										<td' . $data['BusinessDepartment'][2] . '>' . ConvertUtils::WMHtmlSpecialChars($data['BusinessDepartment'][1]) . '</td>
										<td' . $data['BusinessOffice'][0] . '>' . JS_LANG_Office . ':</td>
										<td' . $data['BusinessOffice'][2] . '>' . ConvertUtils::WMHtmlSpecialChars($data['BusinessOffice'][1]) . '</td>
									</tr>
									<tr' . $data['BusinessStreet'][0] . '>
										<td class="wm_contacts_view_title">' . JS_LANG_StreetAddress . ':</td>
										<td colspan="3">' . ConvertUtils::WMHtmlSpecialChars($data['BusinessStreet'][1]) . '</td>
									</tr>
									<tr' . $class_13 . '>
										<td' . $data['BusinessCity'][0] . '>' . JS_LANG_City . ':</td>
										<td' . $data['BusinessCity'][2] . '>' . ConvertUtils::WMHtmlSpecialChars($data['BusinessCity'][1]) . '</td>
										<td' . $data['BusinessFax'][0] . '>' . JS_LANG_Fax . ':</td>
										<td' . $data['BusinessFax'][2] . '>' . ConvertUtils::WMHtmlSpecialChars($data['BusinessFax'][1]) . '</td>
									</tr>
									<tr' . $class_14 . '>
										<td' . $data['BusinessState'][0] . '>' . JS_LANG_StateProvince . ':</td>
										<td' . $data['BusinessState'][2] . '>' . ConvertUtils::WMHtmlSpecialChars($data['BusinessState'][1]) . '</td>
										<td' . $data['BusinessPhone'][0] . '>' . JS_LANG_Phone . ':</td>
										<td' . $data['BusinessPhone'][2] . '>' . ConvertUtils::WMHtmlSpecialChars($data['BusinessPhone'][1]) . '</td>
									</tr>
									<tr' . $class_15 . '>
										<td' . $data['BusinessZip'][0] . '>' . JS_LANG_ZipCode . ':</td>
										<td' . $data['BusinessZip'][2] . '>' . ConvertUtils::WMHtmlSpecialChars($data['BusinessZip'][1]) . '</td>
										<td' . $data['BusinessCountry'][0] . '>' . JS_LANG_CountryRegion . ':</td>
										<td' . $data['BusinessCountry'][2] . '>' . ConvertUtils::WMHtmlSpecialChars($data['BusinessCountry'][1]) . '</td>
									</tr>
									<tr' . $data['BusinessWeb'][0] . '>
										<td class="wm_contacts_view_title">' . JS_LANG_WebPage . ':</td>
										<td colspan="3">
											' . ConvertUtils::WMHtmlSpecialChars($data['BusinessWeb'][1]) . '
										</td>
									</tr>
								</table>
								<table' . $class_20 . '>
									<tr>
										<td class="wm_contacts_section_name" colspan="2">' . JS_LANG_Other . '</td>
									</tr>
									<tr' . $Birthday[0] . '>
										<td class="wm_contacts_view_title">' . JS_LANG_Birthday . ':</td>
										<td>' . $Birthday[1] . '</td>
									</tr>
									<tr' . $data['OtherEmail'][0] . '>
										<td class="wm_contacts_view_title">' . JS_LANG_OtherEmail . ':</td>
										<td><a href="#" onclick="return MessageToMail(\'' . ConvertUtils::AttributeQuote(ConvertUtils::ClearJavaScriptString(ConvertUtils::WMHtmlSpecialChars($data['OtherEmail'][1]), '\'')) . '\')">' . ConvertUtils::WMHtmlSpecialChars($data['OtherEmail'][1]) . '</a></td>
									</tr>
									<tr' . $data['Notes'][0] . '>
										<td class="wm_contacts_view_title">' . JS_LANG_Notes . ':</td>
										<td>' . ConvertUtils::WMHtmlSpecialChars($data['Notes'][1]) . '</td>
									</tr>
								</table>
								' . $groupsHtml . '
								<table class="wm_contacts_view">
									<tr>
										<td>
											<a href="#" id="switch_to_edit">' . JS_LANG_EditContact . '</a>
										</td>
									</tr>
								</table>
							</div>
							
	<!-- -->
							<div id="editTbl" class="wm_hide">
								<table class="wm_contacts_view">
									<tr>
										<td class="wm_contacts_view_title" style="width: 25%;">' . JS_LANG_DefaultEmail . ':</td>
										<td style="width: 75%;">
											<span id="notSpecified" class="wm_hide">' . JS_LANG_NotSpecifiedYet . '</span>
											<select id="select_default_email" class="wm_hide" style="width: 200px;"></select>
											<input id="input_default_email" name="input_default_email" type="text" value="' . ConvertUtils::AttributeQuote($Email[1]) . '" class="wm_input" maxlength="255"/>
											<input id="default_email_type" type="hidden" name="default_email_type" value="' . ConvertUtils::AttributeQuote($contact->PrimaryEmail) . '" />
										</td>
									</tr>
									<tr>
										<td class="wm_contacts_view_title" style="width: 25%;">' . JS_LANG_Name . ':</td>
										<td>
										<input class="wm_input" type="text" name="c_fullname" value="' . ConvertUtils::AttributeQuote($data['FullName'][1]) . '" id="c_fullname" maxlength="85" /></td>
									</tr>
									<tr>
										<td></td>
										<td>
											<input class="wm_checkbox" type="checkbox" name="use_friendly_name" id="use_friendly_name" value="1" ' . $useFrName . '>
											<label for="use_friendly_name">' . JS_LANG_UseFriendlyName1 . '</label><label class="wm_secondary_info wm_inline_info" for="use_friendly_name">' . JS_LANG_UseFriendlyName2 . '</label>
										</td>
									</tr>
								</table>
								<div class="wm_hide" id="more_info_div">
								<table class="wm_contacts_view" style="width: 94%; margin: 0px 15px 2px 15px;">
									<tr>
										<td style="text-align: right; border-top: solid 1px #8D8C89;">
											<a href="" id="more_info_hide">' . JS_LANG_HideAddFields . '</a>
										</td>
									</tr>
								</table>
								<table class="wm_contacts_tab" onclick="ChangeTabVisibility(\'access\');">
									<tr>
										<td>
											<span class="wm_contacts_tab_name">
												' . JS_LANG_Home . '
											</span>
											<span class="wm_contacts_tab_mode">
												<img id="button_access" src="skins/' . $skinName . '/menu/arrow_up.gif">
											</span>
										</td>
									</tr>
								</table>
								<table ' . $class_00 . ' id="access">
									<tr>
										<td class="wm_contacts_view_title" style="width: 20%;">' . JS_LANG_PersonalEmail . ':</td>
										<td style="width: 80%;" colspan="4"><input autocomplete="off" class="wm_input" type="text" size="45" id="personal_email" name="personal_email" value="' . ConvertUtils::AttributeQuote($data['HomeEmail'][1]) . '" maxlength="255" /></td>
									</tr>
									<tr>
										<td class="wm_contacts_view_title" style="width: 20%;">' . JS_LANG_StreetAddress . ':</td>
										<td colspan="4"><textarea class="wm_input" rows="2" cols="35" name="personal_street" rows="4">' . $data['HomeStreet'][1] . '</textarea></td>
									</tr>
									<tr>
										<td class="wm_contacts_view_title" style="width: 20%;">' . JS_LANG_City . ':</td>
										<td style="width: 30%;"><input class="wm_input" type="text" size="18" name="personal_city" value="' . ConvertUtils::AttributeQuote($data['HomeCity'][1]) . '" maxlength="65" /></td>
										<td style="width: 10%;"></td>
										<td class="wm_contacts_view_title" style="width: 10%;">' . JS_LANG_Fax . ':</td>
										<td style="width: 30%;"><input class="wm_input" type="text" size="18" name="personal_fax" value="' . ConvertUtils::AttributeQuote($data['HomeFax'][1]) . '" maxlength="50"/></td>
									</tr>
									<tr>
										<td class="wm_contacts_view_title" style="width: 20%;">' . JS_LANG_StateProvince . ':</td>
										<td><input class="wm_input" type="text" size="18" name="personal_state" value="' . ConvertUtils::AttributeQuote($data['HomeState'][1]) . '" maxlength="65" /></td>
										<td></td>
										<td class="wm_contacts_view_title">' . JS_LANG_Phone . ':</td>
										<td><input class="wm_input" type="text" size="18" name="personal_phone" value="' . ConvertUtils::AttributeQuote($data['HomePhone'][1]) . '" maxlength="50" /></td>
									</tr>
									<tr>
										<td class="wm_contacts_view_title" style="width: 20%;">' . JS_LANG_ZipCode . ':</td>
										<td><input class="wm_input" type="text" size="18" name="personal_zip" value="' . ConvertUtils::AttributeQuote($data['HomeZip'][1]) . '" maxlength="10" /></td>
										<td></td>
										<td class="wm_contacts_view_title">' . JS_LANG_Mobile . ':</td>
										<td><input class="wm_input" type="text" size="18" name="personal_mobile" value="' . ConvertUtils::AttributeQuote($data['HomeMobile'][1]) . '" maxlength="50" /></td>
									</tr>
									<tr>
										<td class="wm_contacts_view_title" style="width: 20%;">' . JS_LANG_CountryRegion . ':</td>
										<td colspan="4"><input class="wm_input" type="text" size="18" name="personal_country" value="' . ConvertUtils::AttributeQuote($data['HomeCountry'][1]) . '" maxlength="65" /></td>
									</tr>
									<tr>
										<td class="wm_contacts_view_title" style="width: 20%;">' . JS_LANG_WebPage . ':</td>
										<td colspan="4">
											<input class="wm_input" type="text" size="45" name="personal_web" id="personal_web" value="' . ConvertUtils::AttributeQuote($data['HomeWeb'][1]) . '" maxlength="255" />
											<input class="wm_button" type="button" value="' . ConvertUtils::AttributeQuote(JS_LANG_Go) . '" onClick="dolocation(\'personal_web\');" />
										</td>
									</tr>
								</table>
								<table class="wm_contacts_tab" onclick="ChangeTabVisibility(\'online_addresses\');">
									<tr>
										<td>
											<span class="wm_contacts_tab_name">
												' . JS_LANG_Business . '
											</span>
											<span class="wm_contacts_tab_mode">
												<img id="button_online_addresses" src="skins/' . $skinName . '/menu/arrow_down.gif">
											</span>
										</td>
									</tr>
								</table>
								<table ' . $class_10 . ' id="online_addresses">
									<tr>
										<td class="wm_contacts_view_title" style="width: 20%;">' . JS_LANG_BusinessEmail . ':</td>
										<td style="width: 80%;" colspan="4"><input class="wm_input" autocomplete="off" type="text" id="business_email" name="business_email" size="45" value="' . ConvertUtils::AttributeQuote($data['BusinessEmail'][1]) . '" maxlength="255" /></td>
									</tr>
									<tr>
										<td class="wm_contacts_view_title" style="width: 20%;">' . JS_LANG_Company . ':</td>
										<td style="width: 30%;"><input class="wm_input" type="text" size="18" name="business_company" value="' . ConvertUtils::AttributeQuote($data['BusinessCompany'][1]) . '" maxlength="65" /></td>
										<td style="width: 5%;"></td>
										<td class="wm_contacts_view_title" style="width: 15%;">' . JS_LANG_JobTitle . ':</td>
										<td style="width: 30%;"><input class="wm_input" type="text" size="18" name="business_job" value="' . ConvertUtils::AttributeQuote($data['BusinessJobTitle'][1]) . '" maxlength="30" /></td>
									</tr>
									<tr>
										<td class="wm_contacts_view_title" style="width: 20%;">' . JS_LANG_Department . ':</td>
										<td><input class="wm_input" type="text" size="18" name="business_departament" value="' . ConvertUtils::AttributeQuote($data['BusinessDepartment'][1]) . '" maxlength="65" /></td>
										<td></td>
										<td class="wm_contacts_view_title">' . JS_LANG_Office . ':</td>
										<td><input class="wm_input" type="text" size="18" name="business_office" value="' . ConvertUtils::AttributeQuote($data['BusinessOffice'][1]) . '" maxlength="65" /></td>
									</tr>
									<tr>
										<td class="wm_contacts_view_title" style="width: 20%;">' . JS_LANG_StreetAddress . ':</td>
										<td colspan="4"><textarea rows="2" class="wm_input" cols="35" name="business_street" rows="4">' . $data['BusinessStreet'][1] . '</textarea></td>
									</tr>
									<tr>
										<td class="wm_contacts_view_title" style="width: 20%;">' . JS_LANG_City . ':</td>
										<td><input class="wm_input" type="text" size="18" name="business_city" value="' . ConvertUtils::AttributeQuote($data['BusinessCity'][1]) . '" maxlength="65" /></td>
										<td></td>
										<td class="wm_contacts_view_title">' . JS_LANG_Fax . ':</td>
										<td><input class="wm_input" type="text" size="18" name="business_fax" value="' . ConvertUtils::AttributeQuote($data['BusinessFax'][1]) . '" maxlength="50" /></td>
									</tr>
									<tr>
										<td class="wm_contacts_view_title" style="width: 20%;">' . JS_LANG_StateProvince . ':</td>
										<td><input class="wm_input" type="text" size="18" name="business_state" value="' . ConvertUtils::AttributeQuote($data['BusinessState'][1]) . '" maxlength="65" /></td>
										<td></td>
										<td class="wm_contacts_view_title">' . JS_LANG_Phone . ':</td>
										<td><input class="wm_input" type="text" size="18" name="business_phone" value="' . ConvertUtils::AttributeQuote($data['BusinessPhone'][1]) . '" maxlength="50" /></td>
									</tr>
									<tr>
										<td class="wm_contacts_view_title" style="width: 20%;">' . JS_LANG_ZipCode . ':</td>
										<td><input class="wm_input" type="text" size="18" name="business_zip" value="' . ConvertUtils::AttributeQuote($data['BusinessZip'][1]) . '" maxlength="10" /></td>
										<td></td>
										<td class="wm_contacts_view_title">' . JS_LANG_CountryRegion . ':</td>
										<td colspan="4"><input class="wm_input" type="text" name="business_country" size="18" value="' . ConvertUtils::AttributeQuote($data['BusinessCountry'][1]) . '" maxlength="65" /></td>
									</tr>
									<tr>
										<td class="wm_contacts_view_title" style="width: 20%;">' . JS_LANG_WebPage . ':</td>
										<td colspan="4">
											<input class="wm_input" type="text" size="45" id="business_web" name="business_web" value="' . ConvertUtils::AttributeQuote($data['BusinessWeb'][1]) . '" maxlength="255" />
											<input class="wm_button" type="button" value="' . ConvertUtils::AttributeQuote(JS_LANG_Go) . '" onClick="dolocation(\'business_web\');" />
										</td>
									</tr>
								</table>
								<table class="wm_contacts_tab" onclick="ChangeTabVisibility(\'phone_numbers\');">
									<tr>
										<td>
											<span class="wm_contacts_tab_name">
												' . JS_LANG_Other . '
											</span>
											<span class="wm_contacts_tab_mode">
												<img id="button_phone_numbers" src="skins/' . $skinName . '/menu/arrow_down.gif">
											</span>
										</td>
									</tr>
								</table>
								<table ' . $class_20 . ' id="phone_numbers">
									<tr>
										<td class="wm_contacts_view_title" style="width: 20%;">' . JS_LANG_Birthday . ':</td>
										<td>
											<select name="birthday_month">
												<option value="0">' . JS_LANG_Month . '</option>
												' . $monthsSelect . '
											</select>
											<select name="birthday_day">
												<option value="0">' . JS_LANG_Day . '</option>
												' . $daysSelect . '
											</select>
											<select name="birthday_year">
												<option value="0">' . JS_LANG_Year . '</option>
												' . $yearsSelect . '
											</select>
										</td>
									</tr>
									<tr>
										<td class="wm_contacts_view_title" style="width: 20%;">' . JS_LANG_OtherEmail . ':</td>
										<td style="width: 80%;"><input class="wm_input" autocomplete="off" id="other_email" name="other_email" type="text" size="45" value="' . ConvertUtils::AttributeQuote($data['OtherEmail'][1]) . '" maxlength="255" /></td>
									</tr>
									<tr>
										<td class="wm_contacts_view_title" style="width: 20%;">' . JS_LANG_Notes . ':</td>
										<td><textarea rows="2" class="wm_input" cols="35" rows="4" name="other_notes">' . $data['Notes'][1] . '</textarea></td>
									</tr>
								</table>
										' . $groupsHtml2 . '
								</div>
								<table class="wm_contacts_view" style="width: 94%; margin: 0px 15px 2px 15px;">
									<tr>
										<td style="text-align: right;">
											<a href="" id="more_info_show">' . JS_LANG_ShowAddFields . '</a>
										</td>
									</tr>
									<tr>
										<td style="text-align: right; border-top: solid 1px #8D8C89;">
											<input type="submit" class="wm_button" value="' . ConvertUtils::AttributeQuote(JS_LANG_Save) . '" />
											<input type="button" class="wm_button" name="cancle" value="' . ConvertUtils::AttributeQuote(JS_LANG_Cancel) . '" ID="Cancel" onclick="DoCancle();" />
										</td>
									</tr>
								</table>
							</div></form>';
    } else {
        $out = '';
    }
    return $out;
}
Esempio n. 21
0
    /**
     * @param PageBuilder $pageBuilder
     * @return ContactsPanel
     */
    function FullScreenPanel(&$pagebuilder)
    {
        $this->_pagebuilder =& $pagebuilder;
        $this->_proc =& $pagebuilder->_proc;
        $this->_pagebuilder->_top->AddOnResize('ResizeElements(\'all\');');
        $this->_pagebuilder->AddJSText('
var sep = "-----";
var logo, accountlist, toolbar, iframe;

function ResizeElements(mode) 
{
	var height = GetHeight();
	var exx = 0; var offsetHeight = 0;
	offsetHeight = (logo) ? logo.offsetHeight : 0; exx += (offsetHeight) ? offsetHeight : 0;
	offsetHeight = (accountlist) ? accountlist.offsetHeight : 0; exx += (offsetHeight) ? offsetHeight : 0;
	offsetHeight = (toolbar) ? toolbar.offsetHeight : 0; exx += (offsetHeight) ? offsetHeight : 0;
	iframe.height = height - exx;		
}

function LoadMessage(newcharset, newplain)
{
	BaseForm.Charset.value = newcharset;
	BaseForm.Plain.value = newplain;
	BaseForm.Form.submit();
}

function DoNewMessageButton()
{
	document.location = "' . BASEFILE . '?' . SCREEN . '=' . SCREEN_NEWOREDIT . '";
}

function DoPrintButton()
{
	var src = "print.php?msg_id=' . Post::val('m_id', '') . '&msg_uid=' . urlencode(Post::val('m_uid', '')) . '&folder_id=' . Post::val('f_id', '') . '&folder_fname=' . urlencode(Post::val('f_name', '')) . '&charset=" + BaseForm.Charset.value;
	var allHeight = GetHeight();
	var allWidth = GetWidth();
	var height = 480; if (height >= allHeight) height = Math.ceil(allHeight*2/3);
	var width = 640; if (width >= allWidth) width = Math.ceil(allWidth*2/3);
	var top = Math.ceil((allHeight - height)/2)
	var left = Math.ceil((allWidth - width)/2)
	var win = window.open(src, "Popup", "toolbar=yes,status=no,scrollbars=yes,resizable=yes,width=" + width + ",height=" + height + ",top=" + top + ",left=" + left);
}

function ChangeCharset(newCharset)
{
	var idline = BaseForm.MessId.value + sep + BaseForm.MessUid.value + sep + BaseForm.FolderId.value + sep + BaseForm.Charset.value + sep;
	var newidline = BaseForm.MessId.value + sep + BaseForm.MessUid.value + sep + BaseForm.FolderId.value + sep + newCharset + sep;
	BaseForm.Charset.value = newCharset;
} 

function DoForwardButton()
{
		BaseForm.Form.action = "' . BASEFILE . '?' . SCREEN . '=' . SCREEN_NEWOREDIT . '";
		BaseForm.Form.target = "_self";
		BaseForm.Plain.value = "-1";
		BaseForm.Type.value = "forward";
		BaseForm.Form.submit();
}

function DoReplyButton()
{
		BaseForm.Form.action = "' . BASEFILE . '?' . SCREEN . '=' . SCREEN_NEWOREDIT . '";
		BaseForm.Form.target = "_self";
		BaseForm.Plain.value = "-1";
		BaseForm.Type.value = "reply";
		BaseForm.Form.submit();
}

function DoReplyAllButton()
{
		BaseForm.Form.action = "' . BASEFILE . '?' . SCREEN . '=' . SCREEN_NEWOREDIT . '";
		BaseForm.Form.target = "_self";
		BaseForm.Plain.value = "-1";
		BaseForm.Type.value = "replytoall";
		BaseForm.Form.submit();
}

function DoSaveButton()
{
	document.location = "attach.php?msg_id=' . Post::val('m_id', '') . '&msg_uid=' . urlencode(Post::val('m_uid', '')) . '&folder_id=' . Post::val('f_id', '') . '&folder_fname=' . urlencode(Post::val('f_name', '')) . '";
}


function AddContact(contactString)
{
	var obj = GetEmailParts(HtmlDecode(contactString));
	var hiddenform = CreateChildWithAttrs(document.body, "form", [["action", "' . BASEFILE . '?' . SCREEN . '=' . SCREEN_CONTACTS . '&' . CONTACT_MODE . '=' . C_NEW . '"], ["target", "_self"], ["method", "POST"]]);
	CreateChildWithAttrs(hiddenform, "input", [["type", "hidden"], ["name", "cdata"], ["value",  "1"]]);
	CreateChildWithAttrs(hiddenform, "input", [["type", "hidden"], ["name", "cemail"], ["value",  obj.Email]]);
	CreateChildWithAttrs(hiddenform, "input", [["type", "hidden"], ["name", "cfullname"], ["value",  obj.Name]]);
	hiddenform.submit();
}


function DoDeleteButton()
{
	if (!confirm("' . ConvertUtils::ClearJavaScriptString(JS_LANG_ConfirmAreYouSure, '"') . '")) {
		return false;
	}
	var hiddenform = CreateChildWithAttrs(document.body, "form", [["action", "' . ACTIONFILE . '?action=delete&req=message"], ["target", "_self"], ["method", "POST"]]);
	CreateChildWithAttrs(hiddenform, "input", [["type", "hidden"], ["name", "messageId"], ["value",  "' . ConvertUtils::ClearJavaScriptString(Post::val('m_id', -1), '"') . '"]]);
	CreateChildWithAttrs(hiddenform, "input", [["type", "hidden"], ["name", "messageUid"], ["value",  "' . ConvertUtils::ClearJavaScriptString(Post::val('m_uid', ''), '"') . '"]]);
	CreateChildWithAttrs(hiddenform, "input", [["type", "hidden"], ["name", "folderId"], ["value",  "' . ConvertUtils::ClearJavaScriptString(Post::val('f_id', -1), '"') . '"]]);
	hiddenform.submit();
}

function CBaseForm()
{
	this.Form = document.getElementById("messform");
	this.MessId = document.getElementById("m_id");
	this.MessUid = document.getElementById("m_uid");
	this.FolderId = document.getElementById("f_id");
	this.FolderName = document.getElementById("f_name");
	this.Charset = document.getElementById("charset");
	this.Plain = document.getElementById("plain");
	this.Type = document.getElementById("mtype");
}
');
        $this->_pagebuilder->AddInitText('
BaseForm = new CBaseForm();
logo = document.getElementById("logo");
accountlist = document.getElementById("accountslist");
toolbar = document.getElementById("toolbar");
iframe = document.getElementById("iframe_container");
SetBodyAutoOverflow(false);
ResizeElements("all");
LoadMessage("' . ConvertUtils::ClearJavaScriptString(Post::val('charset', ''), '"') . '", "' . Post::val('plain', '-1') . '");
			');
    }
Esempio n. 22
0
 /**
  * Основной метод, выполняющий построение страницы
  */
 public final function buildPage()
 {
     //Может ли данная страница вообще быть построена
     check_condition($this->builderIdent, "{$this} не может быть построена");
     //Проверим, установлена ли эта страница, как текущая
     check_condition(WebPages::isCurPage($this), "{$this} не установлена, как текущая, и не может быть построена");
     //Если у пользователя нет доступа к данной странице - выполним редирект
     if (!$this->hasAccess()) {
         $this->redirectHere();
     }
     //Теперь провалидируем установленный контекст
     $ctxt = PageContext::inst();
     check_condition($this->isIt($ctxt->getPage()), PsUtil::getClassName($ctxt) . ' проинициализирован некорректно');
     //Строим страницу
     PageBuilder::inst()->buildPage();
 }
/**
 * Show the import course page.
 */
function WPCW_showPage_ImportExport_importUsers()
{
    $page = new PageBuilder(true);
    $page->showPageHeader(__('Import Users from CSV File', 'wp_courseware'), '75%', WPCW_icon_getPageIconURL());
    // Show selection menu for import/export to save pages
    WPCW_showPage_ImportExport_menu('import_users');
    // Show form to import some XML
    $form = new FormBuilder('wpcw_import_users');
    $form->setSubmitLabel(__('Import Users', 'wp_courseware'));
    // Course upload for XML file
    $formElem = new FormElement('import_course_csv', __('User Import CSV File', 'wp_courseware'), true);
    $formElem->setTypeAsUploadFile();
    $form->addFormElement($formElem);
    if ($form->formSubmitted()) {
        // Do the full export
        if ($form->formValid()) {
            // Handle the importing/uploading
            WPCW_users_importUsersFromFile($page);
        } else {
            $page->showListOfErrors($form->getListOfErrors(), __('Unfortunately, there were some errors trying to import the XML file.', 'wp_courseware'));
        }
    }
    // Workout maximum upload size
    $max_upload = (int) ini_get('upload_max_filesize');
    $max_post = (int) ini_get('post_max_size');
    $memory_limit = (int) ini_get('memory_limit');
    $upload_mb = min($max_upload, $max_post, $memory_limit);
    printf('<p class="wpcw_doc_quick">');
    printf(__('You can import a CSV file of users using the form below.', 'wp_courseware') . ' ' . __('The <b>maximum upload file size</b> for your server is <b>%d MB</b>.', 'wp_courseware'), $upload_mb);
    printf('</p>');
    echo $form->toString();
    printf('<br/><br/><div class="wpcw_docs_wrapper">');
    printf('<b>%s</b>', __('Some tips for importing users via a CSV file:', 'wp_courseware'));
    printf('<ul>');
    printf('<li>' . __('If a user email address already exists, then just the courses are updated for that user.', 'wp_courseware'));
    printf('<li>' . __('User names are generated from the first and last name information. If a user name already exists, then a unique username is generated.', 'wp_courseware'));
    printf('<li>' . __('To add a user to many courses, just separate those course IDs with a comma in the <code>courses_to_add_to</code> column.', 'wp_courseware'));
    printf('<li>' . __('If a user is created, any courses set to be automatically assigned will be done first, and then the courses added in the <code>courses_to_add_to</code> column.', 'wp_courseware'));
    printf('<li>' . __('You can download an <a href="%s">example CSV file here</a>.', 'wp_courseware') . '</li>', admin_url('?wpcw_export=csv_import_user_sample'));
    printf('<li>' . __('The IDs for the training courses can be found on the <a href="%s">course summary page</a>.', 'wp_courseware') . '</li>', admin_url('admin.php?page=WPCW_wp_courseware'));
    printf('</ul>');
    printf('</div>');
    $page->showPageFooter();
}
Esempio n. 24
0
';
        echo base64_decode($favicon);
    } else {
        if ($_GET['file'] == 'style.css') {
            header('Content-type: text/css');
            include "inc/style.css";
        } else {
            if ($_GET['file'] == 'script.js') {
                header('Content-type: text/javascript');
                include "inc/script.js";
            }
        }
    }
    exit;
}
$pb = new PageBuilder('FeedPage');
FeedPage::$pb = $pb;
$pb->assign('base', MyTool::getUrl());
$pb->assign('version', FEED_VERSION);
$pb->assign('pagetitle', 'KrISS feed');
$pb->assign('referer', $referer);
$pb->assign('langs', Intl::$langList);
$pb->assign('lang', Intl::$langList[Intl::$lang]);
$pb->assign('query_string', $_SERVER['QUERY_STRING']);
if (!is_dir(DATA_DIR)) {
    if (!@mkdir(DATA_DIR, 0755)) {
        $pb->assign('message', sprintf(Intl::msg('Can not create %s directory, check permissions'), DATA_DIR));
        $pb->renderPage('message');
    }
    @chmod(DATA_DIR, 0755);
    if (!is_file(DATA_DIR . '/.htaccess')) {
Esempio n. 25
0
/**
 * Show the 'Daily' page.
 *
 * @param PageBuilder $pageBuilder Template engine wrapper.
 */
function showDaily($pageBuilder)
{
    $LINKSDB = new LinkDB($GLOBALS['config']['DATASTORE'], isLoggedIn(), $GLOBALS['config']['HIDE_PUBLIC_LINKS'], $GLOBALS['redirector']);
    $day = Date('Ymd', strtotime('-1 day'));
    // Yesterday, in format YYYYMMDD.
    if (isset($_GET['day'])) {
        $day = $_GET['day'];
    }
    $days = $LINKSDB->days();
    $i = array_search($day, $days);
    if ($i === false) {
        $i = count($days) - 1;
        $day = $days[$i];
    }
    $previousday = '';
    $nextday = '';
    if ($i !== false) {
        if ($i >= 1) {
            $previousday = $days[$i - 1];
        }
        if ($i < count($days) - 1) {
            $nextday = $days[$i + 1];
        }
    }
    try {
        $linksToDisplay = $LINKSDB->filter(LinkFilter::$FILTER_DAY, $day);
    } catch (Exception $exc) {
        error_log($exc);
        $linksToDisplay = array();
    }
    // We pre-format some fields for proper output.
    foreach ($linksToDisplay as $key => $link) {
        $taglist = explode(' ', $link['tags']);
        uasort($taglist, 'strcasecmp');
        $linksToDisplay[$key]['taglist'] = $taglist;
        $linksToDisplay[$key]['formatedDescription'] = format_description($link['description'], $GLOBALS['redirector']);
        $linksToDisplay[$key]['thumbnail'] = thumbnail($link['url']);
        $linksToDisplay[$key]['timestamp'] = linkdate2timestamp($link['linkdate']);
    }
    /* We need to spread the articles on 3 columns.
          I did not want to use a JavaScript lib like http://masonry.desandro.com/
          so I manually spread entries with a simple method: I roughly evaluate the
          height of a div according to title and description length.
       */
    $columns = array(array(), array(), array());
    // Entries to display, for each column.
    $fill = array(0, 0, 0);
    // Rough estimate of columns fill.
    foreach ($linksToDisplay as $key => $link) {
        // Roughly estimate length of entry (by counting characters)
        // Title: 30 chars = 1 line. 1 line is 30 pixels height.
        // Description: 836 characters gives roughly 342 pixel height.
        // This is not perfect, but it's usually OK.
        $length = strlen($link['title']) + 342 * strlen($link['description']) / 836;
        if ($link['thumbnail']) {
            $length += 100;
        }
        // 1 thumbnails roughly takes 100 pixels height.
        // Then put in column which is the less filled:
        $smallest = min($fill);
        // find smallest value in array.
        $index = array_search($smallest, $fill);
        // find index of this smallest value.
        array_push($columns[$index], $link);
        // Put entry in this column.
        $fill[$index] += $length;
    }
    $data = array('linksToDisplay' => $linksToDisplay, 'linkcount' => count($LINKSDB), 'cols' => $columns, 'day' => linkdate2timestamp($day . '_000000'), 'previousday' => $previousday, 'nextday' => $nextday);
    $pluginManager = PluginManager::getInstance();
    $pluginManager->executeHooks('render_daily', $data, array('loggedin' => isLoggedIn()));
    foreach ($data as $key => $value) {
        $pageBuilder->assign($key, $value);
    }
    $pageBuilder->renderPage('daily');
    exit;
}
Esempio n. 26
0
 private function __construct()
 {
     PsProfiler::inst(__CLASS__)->start(__FUNCTION__);
     $managers = array(MagManager::inst(), BlogManager::inst(), TrainManager::inst());
     foreach ($managers as $manager) {
         //Соберём типы постов
         $this->postTypes[] = $manager->getPostType();
         if ($manager instanceof RubricsProcessor) {
             $this->rubricsProcessors[$manager->getPostType()] = $manager;
             $this->foldings[] = $manager->getRubricsFolding();
         }
         if ($manager instanceof PostsProcessor) {
             $this->postsProcessors[$manager->getPostType()] = $manager;
             $this->foldings[] = $manager->getFolding();
         }
         if ($manager instanceof CommentsProcessor) {
             $this->commentProcessors[$manager->getPostType()] = $manager;
             $this->discussionControllers[$manager->getDiscussionController()->getDiscussionUnique()] = $manager->getDiscussionController();
         }
         if ($manager instanceof PagePreloadListener) {
             $this->pagePreloadListeners[] = $manager;
         }
         if ($manager instanceof NewsProvider) {
             $this->newsProviders[$manager->getNewsEventType()] = $manager;
         }
     }
     //Контроллеры дискуссий
     $this->discussionControllers[FeedbackManager::inst()->getDiscussionUnique()] = FeedbackManager::inst();
     //Фолдинги
     $this->foldings[] = PopupPagesManager::inst();
     $this->foldings[] = PluginsManager::inst();
     $this->foldings[] = IdentPagesManager::inst();
     $this->foldings[] = TimeLineManager::inst();
     $this->foldings[] = TemplateMessages::inst();
     $this->foldings[] = UserPointsManager::inst();
     $this->foldings[] = StockManager::inst();
     $this->foldings[] = HelpManager::inst();
     $this->foldings[] = EmailManager::inst();
     $this->foldings[] = PSForm::inst();
     $this->foldings[] = DialogManager::inst();
     //Библиотеки
     $this->foldings[] = PoetsManager::inst();
     $this->foldings[] = ScientistsManager::inst();
     //Админские страницы
     $this->foldings[] = APagesResources::inst();
     //Базовые страницы
     $this->foldings[] = BasicPagesManager::inst();
     //Построитель страниц
     $this->foldings[] = PageBuilder::inst();
     //Управление списком предпросмотра постов
     $this->foldings[] = ShowcasesCtrlManager::inst();
     //Элементы в правой панели навигации
     $this->foldings[] = ClientBoxManager::inst();
     /*
      * Выделим различные подклассы фолдингов
      */
     foreach ($this->foldings as $folding) {
         //Фолдинги библиотек
         if ($folding instanceof LibResources) {
             $this->libs[] = $folding;
         }
         //Фолдинги обработчиков постов
         if ($folding instanceof PostFoldedResources) {
             $this->postProcessorFoldings[] = $folding;
         }
         //Фолдинги для баблов
         if ($folding instanceof BubbledFolding) {
             $this->bubbles[] = $folding;
         }
         //Фолдинги, предоставляющие панели
         if ($folding instanceof PanelFolding) {
             $this->panels[] = $folding;
         }
         //Фолдинги, финализирующие контент страницы
         if ($folding instanceof PageFinalizerFolding) {
             $this->pageFinaliseFoldings[] = $folding;
         }
         //Индексированный список фолдингов
         $this->folding2unique[$folding->getUnique()] = $folding;
         //Префиксы smarty к фолдингам
         $this->folding2smartyPrefix[$folding->getSmartyPrefix()] = $folding;
         //Префиксы классов к фолдингам
         if ($folding->getClassPrefix()) {
             $this->folding2classPrefix[$folding->getClassPrefix()] = $folding;
         }
     }
     PsProfiler::inst(__CLASS__)->stop();
 }
Esempio n. 27
0
        //$pagecontent .= '<p><b>This page is a child page of <a href="index.php?p='.$row['page_childof'].'">this page</a>.</b></p>';
        $pagecontent .= $row['page_content'];
        if ($j > 0) {
            $pagecontent = 'wtf';
        }
        $j += 1;
    }
}
// get list of media
$mediaquery = mysql_query("SELECT * FROM files");
// you need at least php 5.2.0
if (version_compare('5.2.0', PHP_VERSION, '>')) {
    exit($txt['page_oldphp']);
}
// set up the templating system
$page = new PageBuilder();
register_shutdown_function(array($page, 'outputAll'));
// and now let's have some content!
ob_start('parsebbcode');
$page->addBodyClass('page-' . preg_replace('/[^a-zA-Z0-9\\s]/', '', $pid));
switch ($_GET['p']) {
    case 'logout':
        include $location['admin2'] . '/logout.php';
        break;
    case 'media':
        include $location['root'] . '/media.php';
        break;
    default:
        if ($j == 0) {
            $page->setTitle($txt['text_error']);
            echo $txt['noexist'];
Esempio n. 28
0
/**
 * Page where the modules of a course can be ordered.
 */
function WPCW_showPage_CourseOrdering_load()
{
    $page = new PageBuilder(false);
    $page->showPageHeader(__('Order Course Modules &amp; Units', 'wp_courseware'), '75%', WPCW_icon_getPageIconURL());
    $courseDetails = false;
    $courseID = false;
    // Trying to edit a course
    if (isset($_GET['course_id'])) {
        $courseID = $_GET['course_id'] + 0;
        $courseDetails = WPCW_courses_getCourseDetails($courseID);
    }
    // Abort if course not found.
    if (!$courseDetails) {
        $page->showMessage(__('Sorry, but that course could not be found.', 'wp_courseware'), true);
        $page->showPageFooter();
        return;
    }
    // ###ÊGenerate URLs for editing
    $modifyURL_quiz = admin_url('admin.php?page=WPCW_showPage_ModifyQuiz');
    $modifyURL_module = admin_url('admin.php?page=WPCW_showPage_ModifyModule');
    $modifyURL_unit = admin_url('post.php?action=edit');
    // Title of course being editied
    printf('<div id="wpcw_page_course_title"><span>%s</span> %s</div>', __('Editing Course:', 'wp_courseware'), $courseDetails->course_title);
    // Overall wrapper
    printf('<div id="wpcw_dragable_wrapper">');
    printf('<div id="wpcw_unassigned_wrapper" class="wpcw_floating_menu">');
    // ### Show a list of units that are not currently assigned to a module
    printf('<div id="wpcw_unassigned_units" class="wpcw_unassigned">');
    printf('<div class="wpcw_unassigned_title">%s</div>', __('Unassigned Units', 'wp_courseware'));
    printf('<ol class="wpcw_dragable_units_connected">');
    // Render each unit so that it can be dragged to a module. Still render <ol> list
    // even if there are no units to show so that we can drag units into unassociated list.
    $units = WPCW_units_getListOfUnits(0);
    if ($units) {
        foreach ($units as $unassUnit) {
            // Has unit got any existing quizzes?
            $existingQuiz = false;
            $quizObj = WPCW_quizzes_getAssociatedQuizForUnit($unassUnit->ID, false, false);
            if ($quizObj) {
                $existingQuiz = sprintf('<li id="wpcw_quiz_%d" class="wpcw_dragable_quiz_item">
								<div><a href="%s&quiz_id=%d" target="_blank" title="%s">%s (ID: %d)</a></div>
								<div class="wpcw_quiz_des">%s</div>
							</li>', $quizObj->quiz_id, $modifyURL_quiz, $quizObj->quiz_id, __('Edit this quiz...', 'wp_courseware'), $quizObj->quiz_title, $quizObj->quiz_id, $quizObj->quiz_desc);
            }
            printf('<li id="wpcw_unit_%d" class="wpcw_dragable_unit_item">						
						<div><a href="%s&post=%d" target="_blank" title="%s">%s (ID: %d)</a></div>
						<div class="wpcw_dragable_quiz_holder"><ol class="wpcw_dragable_quizzes_connected wpcw_one_only">%s</ol></div>
					</li>', $unassUnit->ID, $modifyURL_unit, $unassUnit->ID, __('Edit this unit...', 'wp_courseware'), $unassUnit->post_title, $unassUnit->ID, $existingQuiz);
        }
    }
    printf('</ol>');
    printf('</div>');
    // ### Show a list of quizzes that are not currently assigned to units
    printf('<div id="wpcw_unassigned_quizzes" class="wpcw_unassigned">');
    printf('<div class="wpcw_unassigned_title">%s</div>', __('Unassigned Quizzes', 'wp_courseware'));
    printf('<ol class="wpcw_dragable_quizzes_connected">');
    // Render each unit so that it can be dragged to a module. Still render <ol> list
    // even if there are no units to show so that we can drag units into unassociated list.
    $quizzes = WPCW_quizzes_getListOfQuizzes(0);
    if ($quizzes) {
        foreach ($quizzes as $quizObj) {
            printf('<li id="wpcw_quiz_%d" class="wpcw_dragable_quiz_item">
								<div><a href="%s&quiz_id=%d" target="_blank" title="%s">%s (ID: %d)</a></div>
								<div class="wpcw_quiz_des">%s</div>
							</li>', $quizObj->quiz_id, $modifyURL_quiz, $quizObj->quiz_id, __('Edit this quiz...', 'wp_courseware'), $quizObj->quiz_title, $quizObj->quiz_id, $quizObj->quiz_desc);
        }
    }
    printf('</ol>');
    printf('</div>');
    printf('</div>');
    // end of printf('<div class="wpcw_unassigned_wrapper">');
    // ### Show list of modules and current units
    $moduleList = WPCW_courses_getModuleDetailsList($courseID);
    if ($moduleList) {
        printf('<ol class="wpcw_dragable_modules">');
        foreach ($moduleList as $item_id => $moduleObj) {
            // Module
            printf('<li id="wpcw_mod_%d" class="wpcw_dragable_module_item">
						<div>
							<a href="%s&module_id=%d" target="_blank" title="%s"><b>%s %d - %s (ID: %d)</b></a>
						</div>', $item_id, $modifyURL_module, $item_id, __('Edit this module...', 'wp_courseware'), __('Module', 'wp_courseware'), $moduleObj->module_number, $moduleObj->module_title, $item_id);
            // Test Associated Units
            printf('<ol class="wpcw_dragable_units_connected">');
            $units = WPCW_units_getListOfUnits($item_id);
            if ($units) {
                foreach ($units as $unassUnit) {
                    $existingQuiz = false;
                    // Has unit got any existing quizzes?
                    $quizObj = WPCW_quizzes_getAssociatedQuizForUnit($unassUnit->ID, false, false);
                    $existingQuiz = false;
                    if ($quizObj) {
                        $existingQuiz = sprintf('<li id="wpcw_quiz_%d" class="wpcw_dragable_quiz_item">
								<div><a href="%s&quiz_id=%d" target="_blank" title="%s">%s (ID: %d)</a></div>
								<div class="wpcw_quiz_des">%s</div>
							</li>', $quizObj->quiz_id, $modifyURL_quiz, $quizObj->quiz_id, __('Edit this quiz...', 'wp_courseware'), $quizObj->quiz_title, $quizObj->quiz_id, $quizObj->quiz_desc);
                    }
                    printf('<li id="wpcw_unit_%d" class="wpcw_dragable_unit_item">						
						<div><a href="%s&post=%d" target="_blank" title="%s">%s (ID: %d)</a></div>
						<div class="wpcw_dragable_quiz_holder"><ol class="wpcw_dragable_quizzes_connected wpcw_one_only">%s</ol></div>
					</li>', $unassUnit->ID, $modifyURL_unit, $unassUnit->ID, __('Edit this unit...', 'wp_courseware'), $unassUnit->post_title, $unassUnit->ID, $existingQuiz);
                }
            }
            printf('</ol></li>');
        }
        printf('</ol>');
    } else {
        _e('No modules yet.', 'wp_courseware');
    }
    ?>
	<div id="wpcw_sticky_bar" style="display: none">
		<div id="wpcw_sticky_bar_inner">
			<a href="#" id="wpcw_dragable_modules_save" class="button-primary"><?php 
    _e('Save Changes to Ordering', 'wp_courseware');
    ?>
</a>
			<span id="wpcw_sticky_bar_status" title="<?php 
    _e('Ordering has changed. Ready to save changes?', 'wp_courseware');
    ?>
"></span>
		</div>
	</div>
	<?php 
    // Close overall wrapper
    printf('</div>');
    $page->showPageFooter();
}
Esempio n. 29
0
<?php

include 'config.php';
include '../../common/header.php';
$pageBuilder = new PageBuilder();
$pageBuilder->getHeader();
$pageBuilder->setTable("test_page_builder");
$pageBuilder->setIdField("id");
$pageBuilder->setDescField("text");
$pageBuilder->setIdValue($_REQUEST["id"]);
echo $pageBuilder->execute();
include_once '../../common/footer.php';
Esempio n. 30
0
<?php

session_start();
//Auto Class load
require_once 'include/classes/class_autoload.php';
Core::init();
Core::loadConfig(Core::$mainConfigPath);
Core::setCssCaching(Core::$mainConfig['tpl']['cssCaching']);
$page = $_GET['page'];
if ($page == null) {
    $page = "index";
}
$PB = new PageBuilder($page);
?>
		
		<html>
		<head>
		
		
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
		
		<link rel="shortcut icon" href="../favicon.ico" type="image/x-icon" />
		<link href='http://fonts.googleapis.com/css?family=Orbitron:500' rel='stylesheet' type='text/css'>
		<link href='/include/javascript/jQuery/jquery-ui.css' rel='stylesheet' type='text/css'>
		<link href='/required/anibutton.css' rel='stylesheet' type='text/css'>
		
		<?php 
//CSS HEAD WIRD IMMER GELADEN
$PB->requiredHead();
PageBuilder::loadHeadByPath("navigation", "template/module/navigation");
$PB->CSShead();