Esempio n. 1
0
    public function getContent()
    {
        $out = '';
        if (Docebo::user()->getUserLevelId() == ADMIN_GROUP_USER) {
            return $out;
        }
        if (empty($this->_contentOut) && $this->print_if_empty === false) {
            return $out;
        }
        $out .= Util::get_js(Get::rel_path('base') . '/lib/js_utils.js', true, false) . Util::get_js(Get::rel_path('base') . '/widget/dialog/dialog.js', true, false) . '<div id="def_lang" class="def_lang">' . "\n" . implode($this->_startOut) . '<div id="link_container">' . implode($this->_contentOut) . '</div>' . '<a id="command" href="#" onclick="YAHOO.Animation.BlindToggle(\'link_container\');" >' . Lang::t('_NOT_TRANSLATED', 'standard', 'framework') . ' (' . count($this->_contentOut) . ')' . '</a>' . '<script type="text/javascript">' . 'YAHOO.util.Dom.get(\'link_container\').style.display = \'none\';' . '</script>' . '<script type="text/javascript">
				var translation = { module: "", key: "" }
				YAHOO.util.Event.onDOMReady(function() {

					var dialogEvent = function(e) {
						var oConfig = {
							modal: true,
							close: true,
							visible: false,
							fixedcenter: true,
							constraintoviewport: true,
							draggable: true,
							hideaftersubmit: false,
							isDynamic: true,
							ajaxUrl: "ajax.adm_server.php?r=adm/lang/translatemask",
							confirmOnly: false,
							directSubmit: false
						};
						oConfig.renderEvent = function() {
							new YAHOO.widget.TabView("translation_tab");
							YAHOO.util.Event.onAvailable(\'lang_module\', function() {
								YAHOO.util.Dom.get(\'lang_module\').value = translation.module;
								YAHOO.util.Dom.get(\'lang_key\').value = translation.key;
							}, this);
						};
						oConfig.callback = function() { this.destroy(); };

						var info = this.id.split("-");
						translation.module = info[1];
						translation.key = info[2];
						CreateDialog("translation_add", oConfig).call(this, e);
					}
					YAHOO.util.Event.addListener(YAHOO.util.Selector.query(\'a[id^=totranslate]\'), "click", dialogEvent);
				});
				</script>' . implode($this->_endOut) . '</div>' . "\n";
        //ob_clean();
        $out = fillSiteBaseUrlTag($out);
        return $out;
    }
Esempio n. 2
0
 function send_certificate($id_certificate, $id_user, $id_course, $array_substituton = false, $download = true, $from_multi = false)
 {
     $id_meta = Get::req('idmeta', DOTY_INT, 0);
     if (!isset($_GET['idmeta'])) {
         $query_certificate = "\r\n\t\t\tSELECT cert_file\r\n\t\t\tFROM " . $GLOBALS['prefix_lms'] . "_certificate_assign\r\n\t\t\tWHERE id_certificate = '" . $id_certificate . "'\r\n\t\t\t\t AND id_course = '" . $id_course . "'\r\n\t\t\t\t AND id_user = '******' ";
     } else {
         $query_certificate = "\r\n\t\t\tSELECT cert_file\r\n\t\t\tFROM " . $GLOBALS['prefix_lms'] . "_certificate_meta_assign\r\n\t\t\tWHERE idUser = '******'\r\n\t\t\tAND idMetaCertificate = '" . $id_meta . "'";
     }
     $re = sql_query($query_certificate);
     echo mysql_error();
     if (mysql_num_rows($re) > 0) {
         if (!$download) {
             return;
         }
         require_once _base_ . '/lib/lib.download.php';
         list($cert_file) = sql_fetch_row($re);
         sendFile(CERTIFICATE_PATH, $cert_file);
         return;
     }
     $query_certificate = "\r\n\t\tSELECT name, cert_structure, base_language, orientation, bgimage\r\n\t\tFROM " . $GLOBALS['prefix_lms'] . "_certificate\r\n\t\tWHERE id_certificate = '" . $id_certificate . "'";
     list($name, $cert_structure, $base_language, $orientation, $bgimage) = sql_fetch_row(sql_query($query_certificate));
     require_once _base_ . '/lib/lib.upload.php';
     if ($array_substituton !== false) {
         $cert_structure = str_replace(array_keys($array_substituton), $array_substituton, $cert_structure);
     }
     $cert_structure = fillSiteBaseUrlTag($cert_structure);
     $cert_file = $id_course . '_' . $id_certificate . '_' . $id_user . '_' . time() . '_' . $name . '.pdf';
     sl_open_fileoperations();
     if (!($fp = sl_fopen(CERTIFICATE_PATH . $cert_file, 'w'))) {
         sl_close_fileoperations();
         return false;
     }
     if (!fwrite($fp, $this->getPdf($cert_structure, $name, $bgimage, $orientation, false, false, true))) {
         sl_close_fileoperations();
         return false;
     }
     fclose($fp);
     sl_close_fileoperations();
     //save the generated file in database
     if (!isset($_GET['idmeta'])) {
         $query = "INSERT INTO " . $GLOBALS['prefix_lms'] . "_certificate_assign " . " ( id_certificate, id_course, id_user, on_date, cert_file ) " . " VALUES " . " ( '" . $id_certificate . "', '" . $id_course . "', '" . $id_user . "', '" . date("Y-m-d H:i:s") . "', '" . addslashes($cert_file) . "' ) ";
     } else {
         $query = "INSERT INTO " . $GLOBALS['prefix_lms'] . "_certificate_meta_assign " . " ( idUser, idMetaCertificate, idCertificate, on_date, cert_file ) " . " VALUES " . " ('" . $id_user . "', '" . $id_meta . "', '" . $id_certificate . "', '" . date("Y-m-d H:i:s") . "', '" . addslashes($cert_file) . "' ) ";
     }
     if (!sql_query($query)) {
         return false;
     }
     if ($from_multi) {
         return;
     }
     $this->getPdf($cert_structure, $name, $bgimage, $orientation, $download, false);
 }