コード例 #1
0
 function makeInvoicePDF($print_row, $filename)
 {
     global $JLMS_CONFIG;
     $JLMS_LANGUAGE1 = array();
     JLMS_require_lang($JLMS_LANGUAGE1, 'pdf.lang', $JLMS_CONFIG->get('default_language'), 'frontend');
     JLMS_processLanguage($JLMS_LANGUAGE1);
     $image_logo = JPATH_SITE . DS . 'images' . DS . 'joomlalms_invoice_logo.jpg';
     $logo_offset = 0;
     $this->pdf->AddPage();
     $top = 20;
     if (file_exists($image_logo)) {
         $this->pdf->Image($image_logo, '', '', 56);
     }
     $imgRBY = $this->pdf->getImageRBY();
     $dYl = $imgRBY ? $imgRBY + 4 : $top;
     $this->pdf->SetFontSize(12);
     $this->pdf->Text(140, $top, $print_row->site_name);
     $this->pdf->SetFontSize(14);
     $this->pdf->text(10, $dYl, _JLMS_INVOICE_HEADER);
     $dYl += 8;
     $this->pdf->setFont('freesansi', 'I');
     //choose font
     $th_text = _JLMS_INVOICE_NUMBER_TEXT . $print_row->invoice_number;
     $this->pdf->SetFontSize(6);
     $this->pdf->text(10, $dYl, $th_text);
     $dYl += 4;
     $th_text = _JLMS_INVOICE_DATE_TEXT . JLMS_dateToDisplay($print_row->date);
     $this->pdf->SetFontSize(6);
     $this->pdf->text(10, $dYl, $th_text);
     $this->pdf->setFont('freesans');
     //choose font
     $sdvig = 0;
     $site_descr = explode(chr(13), $print_row->site_descr);
     $this->pdf->SetFontSize(8);
     $dYr = $top + 8;
     for ($i = 0; $i < count($site_descr); $i++) {
         $this->pdf->text(140, $dYr + $sdvig, trim(stripslashes($site_descr[$i])));
         $sdvig += 4;
     }
     $comp_descr = explode(chr(13), $print_row->comp_descr);
     $dYr += $sdvig + 8;
     $sdvig = 0;
     for ($i = 0; $i < count($comp_descr); $i++) {
         $this->pdf->text(140, $dYr + $sdvig, trim(str_replace(chr(13), '', stripslashes($comp_descr[$i]))));
         $sdvig += 4;
     }
     $this->pdf->SetFontSize(12);
     $dYl += $sdvig + 10;
     $this->pdf->text(10, $dYl, _JLMS_INVOICE_CUSTOMER_INFO_HEADER);
     $this->pdf->setFont('freesansb');
     //choose font
     $custom_invoice_fields = $JLMS_CONFIG->get('custom_invoice_fields', array());
     $this->pdf->SetFontSize(8);
     $dYl += 4;
     $left = 25;
     if (!empty($custom_invoice_fields)) {
         $sdvig = 0;
         foreach ($custom_invoice_fields as $cif) {
             $ftext = $cif->lang_var;
             if (defined($ftext)) {
                 $ftext = constant($ftext);
             }
             $this->pdf->text($left, $dYl + $sdvig, $ftext);
             $sdvig += 4;
         }
         $this->pdf->setFont('freesans');
         //choose font
         $sdvig = 0;
         foreach ($custom_invoice_fields as $cif) {
             $fname = $cif->var_name;
             $ftext = $print_row->{$fname};
             $this->pdf->text($left + 30, $dYl + $sdvig, stripslashes($ftext));
             $sdvig += 4;
         }
         $dYl += $sdvig;
     } else {
         $dYl2 = $dYl;
         $left = 25;
         $this->pdf->text($left, $dYl, _JLMS_INVOICE_CUSTOMER_NAME_TEXT);
         $dYl += 4;
         $this->pdf->text($left, $dYl, _JLMS_INVOICE_CUSTOMER_COMPANY_TEXT);
         $dYl += 4;
         $this->pdf->text($left, $dYl, _JLMS_INVOICE_CUSTOMER_ADDRESS_TEXT);
         $dYl += 4;
         $this->pdf->text($left, $dYl, _JLMS_INVOICE_CUSTOMER_CITY_TEXT);
         $dYl += 4;
         $this->pdf->text($left, $dYl, _JLMS_INVOICE_CUSTOMER_PHONE_TEXT);
         $this->pdf->setFont('freesans');
         //choose font
         $this->pdf->text($left + 30, $dYl2, stripslashes($print_row->name));
         $dYl2 += 4;
         $this->pdf->text($left + 30, $dYl2, stripslashes($print_row->company));
         $dYl2 += 4;
         $this->pdf->text($left + 30, $dYl2, stripslashes($print_row->address));
         $dYl2 += 4;
         $this->pdf->text($left + 30, $dYl2, stripslashes($print_row->city));
         $dYl2 += 4;
         $this->pdf->text($left + 30, $dYl2, stripslashes($print_row->phone));
     }
     if (chop($print_row->comments)) {
         $this->pdf->SetFontSize(12);
         $dYl += 10;
         $this->pdf->text(10, $dYl, _JLMS_INVOICE_COMMENTS_HEADER);
         $comments = explode(chr(13), $print_row->comments);
         $this->pdf->SetFontSize(8);
         $sdvig = 0;
         for ($i = 0; $i < count($comments); $i++) {
             $this->pdf->text(10, $dYl + 6 + $sdvig, trim(str_replace(chr(13), '', stripslashes($comments[$i]))));
             $sdvig += 4;
         }
     }
     $dYl += $sdvig + 6;
     if (isset($print_row->is_sales)) {
         $this->pdf->SetFontSize(10);
         $this->pdf->SetY($dYl);
         $this->pdf->Ln();
         $this->pdf->Cell(30, 8, 'SALESPERSON', 1, 0, 'C');
         $this->pdf->Cell(30, 8, 'P.O. NUMBER', 1, 0, 'C');
         $this->pdf->Cell(30, 8, 'REQUISITIONER', 1, 0, 'C');
         $this->pdf->Cell(30, 8, 'SHIPPED VIA', 1, 0, 'C');
         $this->pdf->Cell(40, 8, 'F.O.B. POINT', 1, 0, 'C');
         $this->pdf->Cell(30, 8, 'TERMS', 1, 0, 'C');
         $this->pdf->Ln();
         $this->pdf->Cell(30, 8, $print_row->sales_name, 1, 0, 'C');
         $this->pdf->Cell(30, 8, $print_row->po_number, 1, 0, 'C');
         $this->pdf->Cell(30, 8, $print_row->requistioner, 1, 0, 'C');
         $this->pdf->Cell(30, 8, $print_row->shipped_via, 1, 0, 'C');
         $this->pdf->Cell(40, 8, $print_row->fob_point, 1, 0, 'C');
         $this->pdf->Cell(30, 8, $print_row->terms, 1, 0, 'C');
         $this->pdf->Ln();
         $dYl += 20;
     }
     $was_add_details = false;
     $data = array();
     $w1 = 40;
     $w2 = 65;
     $w3 = 45;
     $w4 = 40;
     $this->pdf->SetY($dYl);
     $this->pdf->Ln();
     $this->pdf->Cell($w1, 8, _JLMS_INVOICE_UNITS_TABLE_QUANTITY_COLUMN, 1, 0, 'C');
     $this->pdf->Cell($w2, 8, _JLMS_INVOICE_UNITS_TABLE_DESC_COLUMN, 1, 0, 'C');
     $this->pdf->Cell($w3, 8, _JLMS_INVOICE_UNITS_TABLE_UNITPRICE_COLUMN, 1, 0, 'C');
     $this->pdf->Cell($w4, 8, _JLMS_INVOICE_UNITS_TABLE_TOTALPRICE_COLUMN, 1, 0, 'C');
     $this->pdf->Ln();
     if (!empty($print_row->payment_details) && is_array($print_row->payment_details)) {
         foreach ($print_row->payment_details as $pr_pd) {
             $this->pdf->Cell($w1, 8, $pr_pd->quantity, 1, 0, 'C');
             $this->pdf->Cell($w2, 8, stripslashes($pr_pd->name), 1, 0, 'C');
             $this->pdf->Cell($w3, 8, sprintf("%01.2f", $pr_pd->unit_price) . $JLMS_CONFIG->get('jlms_cur_code'), 1, 0, 'C');
             $this->pdf->Cell($w4, 8, sprintf("%01.2f", $pr_pd->quantity * $pr_pd->price) . $JLMS_CONFIG->get('jlms_cur_code'), 1, 0, 'C');
             $this->pdf->Ln();
         }
         $was_add_details = true;
     }
     if (!empty($print_row->payment_details2) && is_array($print_row->payment_details2)) {
         foreach ($print_row->payment_details2 as $pr_pd2) {
             $this->pdf->Cell($w1, 8, $pr_pd2->quantity, 1, 0, 'C');
             $this->pdf->Cell($w2, 8, stripslashes($pr_pd2->name), 1, 0, 'C');
             $this->pdf->Cell($w3, 8, sprintf("%01.2f", $pr_pd2->unit_price) . $JLMS_CONFIG->get('jlms_cur_code'), 1, 0, 'C');
             $this->pdf->Cell($w4, 8, sprintf("%01.2f", $pr_pd2->quantity * $pr_pd->price) . $JLMS_CONFIG->get('jlms_cur_code'), 1, 0, 'C');
             $this->pdf->Ln();
         }
         $was_add_details = true;
     }
     if (!$was_add_details) {
         $this->pdf->Cell($w1, 8, $print_row->quantity, 1, 0, 'C');
         $this->pdf->Cell($w2, 8, stripslashes($print_row->description), 1, 0, 'C');
         $this->pdf->Cell($w3, 8, sprintf("%01.2f", $print_row->price) . $JLMS_CONFIG->get('jlms_cur_code'), 1, 0, 'C');
         $this->pdf->Cell($w4, 8, sprintf("%01.2f", $print_row->quantity * $print_row->price) . $JLMS_CONFIG->get('jlms_cur_code'), 1, 0, 'C');
         $this->pdf->Ln();
     }
     $this->pdf->Cell($w1 + $w2 + $w3, 8, _JLMS_INVOICE_UNITS_TABLE_SUBTOTALPRICE_COLUMN, 0, 0, 'R');
     $this->pdf->Cell($w4, 8, sprintf("%01.2f", $print_row->quantity * $print_row->price) . $JLMS_CONFIG->get('jlms_cur_code'), 1, 0, 'C');
     $this->pdf->Ln();
     $this->pdf->Cell($w1 + $w2 + $w3, 8, _JLMS_INVOICE_UNITS_TABLE_TAXPRICE_COLUMN, 0, 0, 'R');
     $this->pdf->Cell($w4, 8, $print_row->tax_amount, 1, 0, 'C');
     $this->pdf->Ln();
     $this->pdf->Cell($w1 + $w2 + $w3, 8, _JLMS_INVOICE_UNITS_TABLE_SHIPPINGPRICE_COLUMN, 0, 0, 'R');
     $this->pdf->Cell($w4, 8, $print_row->shipping, 1, 0, 'C');
     $this->pdf->Ln();
     $this->pdf->Cell($w1 + $w2 + $w3, 8, _JLMS_INVOICE_UNITS_TABLE_TOTALDUEPRICE_COLUMN, 0, 0, 'R');
     $this->pdf->Cell($w4, 8, sprintf("%01.2f", $print_row->quantity * $print_row->price + $print_row->tax_amount) . $JLMS_CONFIG->get('jlms_cur_code'), 1, 0, 'C');
     $this->pdf->Ln();
     $invoice_descr = explode(chr(13), $print_row->invoice_descr);
     $mysdvig = 8;
     $this->pdf->SetFontSize(8);
     $cur_y = $this->pdf->GetY();
     for ($i = 0; $i < count($invoice_descr); $i++) {
         $this->pdf->text(10, $cur_y + 10 + $mysdvig, trim(str_replace(chr(13), '', stripslashes($invoice_descr[$i]))));
         $mysdvig += 4;
     }
     $th_text = stripslashes($print_row->thanks_text);
     $this->pdf->Ln();
     $this->pdf->SetY(265);
     $this->pdf->Cell(0, 8, $th_text, 0, 0, 'C');
     $this->pdf->Output($filename, 'F');
 }
コード例 #2
0
function JLMS_deleteFromFMS($cids, $course_id, $option, $from_archive = false)
{
    global $Itemid, $my, $JLMS_DB, $JLMS_CONFIG, $JLMS_SESSION, $JLMS_LANGUAGE;
    JLMS_require_lang($JLMS_LANGUAGE, 'conference.lang', $JLMS_CONFIG->get('default_language'));
    JLMS_processLanguage($JLMS_LANGUAGE);
    $where = '';
    if ($cids) {
        $where = " id IN ({$cids}) AND ";
    }
    $query = "SELECT session_name FROM `#__lms_conference_records` WHERE {$where} course_id = '" . $course_id . "'";
    $JLMS_DB->setQuery($query);
    $files = $JLMS_DB->loadObjectList();
    $i = 0;
    $files_list = '';
    foreach ($files as $file) {
        $files_list .= "&amp;arg" . $i . "=" . $file->session_name;
        $i++;
    }
    $query = "DELETE FROM #__lms_conference_records WHERE {$where} course_id = '" . $course_id . "' ";
    $JLMS_DB->SetQuery($query);
    $JLMS_DB->query();
    if ($files_list) {
        $recorded_session = mosGetParam($_REQUEST, 'recorded_session', '');
        $flashcomroot = $JLMS_CONFIG->get('flascommRoot');
        $JLMS_CONFIG->SetPageTitle('Conference | delete records');
        $master = "yes";
        ?>
		<script type="text/javascript" src="<?php 
        echo $JLMS_CONFIG->get('live_site');
        ?>
/components/com_joomla_lms/includes/js/swfobject.js"></script>
		<script type="text/javascript" language="javascript">
		<!--
		function jlms_redirect(){
			<?php 
        if ($from_archive) {
            ?>
			top.location.href = '<?php 
            echo sefRelToAbs("index.php?option={$option}&Itemid={$Itemid}&task=conference&mode=archive&id={$course_id}");
            ?>
';
			<?php 
        } else {
            ?>
			top.location.href = '<?php 
            echo sefRelToAbs("index.php?option={$option}&Itemid={$Itemid}&task=courses");
            ?>
';
			<?php 
        }
        ?>
		}
		//-->
		</script>
		<div class="contentheading"><?php 
        echo _JLMS_CONFERENCE_DELETING;
        ?>
</div>
		<div style="text-align:left " id="deleteRecord">
		<?php 
        if ($from_archive) {
            $JLMS_SESSION->set('joomlalms_sys_message', _JLMS_CONFERENCE_DELETING_INFO);
        } else {
            $JLMS_SESSION->set('joomlalms_sys_message', _JLMS_COURSE_DELETED);
        }
        $params = 'pseudo=' . $my->username . '&amp;course_id=' . $course_id . '&amp;flashcommRoot=' . $flashcomroot . '&amp;master=' . $master . $files_list;
        ?>
		<script type="text/javascript">
		// <![CDATA[
		var so = new SWFObject("components/com_joomla_lms/includes/conference_playback/deleteRecord_106.swf?<?php 
        echo $params;
        ?>
", "deleteRecord", "150", "80", "8", "#ffffff");
		so.addVariable("allowScriptAccess", "sameDomain"); // this line is optional, but this example uses the variable and displays this text inside the flash movie
		so.addVariable("wmode", "transparent");
		so.addVariable("flashvars", "hello there");
		so.addVariable("salign", "t");
		so.addVariable("menu", "false");
		so.write("deleteRecord");
		// ]]>
		</script>
		<?php 
        return false;
        ?>
</div><?php 
    } else {
        if ($from_archive) {
            jlmsRedirect(sefRelToAbs("index.php?option={$option}&Itemid={$Itemid}&task=conference&mode=archive&id={$course_id}"));
        }
        return true;
    }
}
コード例 #3
0
**/
// no direct access
defined('_JEXEC') or die('Restricted access');
if (!defined('_CHAPTER_ID')) {
    define('_CHAPTER_ID', 1);
    define('_DOCUMENT_ID', 2);
    define('_LINK_ID', 3);
    define('_CONTENT_ID', 4);
    define('_QUIZ_ID', 5);
    define('_SCORM_ID', 6);
    define('_LPATH_ID', 7);
}
global $JLMS_LANGUAGE, $JLMS_CONFIG;
//adding non-topic language files
JLMS_require_lang($JLMS_LANGUAGE, array('course_docs.lang', 'course_links', 'course_lpath'), $JLMS_CONFIG->get('default_language'));
JLMS_processLanguage($JLMS_LANGUAGE);
$task = mosGetParam($_REQUEST, 'task', '');
$course_id = intval(mosGetParam($_REQUEST, 'id', 0));
$course_id = intval(mosGetParam($_REQUEST, 'course_id', $course_id));
$topic_id = intval(mosGetParam($_REQUEST, 'topic_id', 0));
$topic_ordering = intval(mosGetParam($_REQUEST, 'topic_ordering', 0));
$element_ordering = intval(mosGetParam($_REQUEST, 'element_ordering', 0));
$state = intval(mosGetParam($_REQUEST, 'state', 0));
$t_id = intval(mosGetParam($_REQUEST, 't_id', 0));
require_once _JOOMLMS_FRONT_HOME . "/joomla_lms.topics.html.php";
require_once _JOOMLMS_FRONT_HOME . "/joomla_lms.topics.class.php";
require_once _JOOMLMS_FRONT_HOME . "/joomla_lms.docs.hlpr.php";
switch ($task) {
    //	case 'details_course':				showCourseDetails( $option );					break;
    case 'orderup_topic':
        orderTopic($course_id, $topic_ordering, -1);
コード例 #4
0
}
require_once JPATH_SITE . DS . 'components' . DS . 'com_joomla_lms' . DS . 'includes' . DS . 'classes' . DS . 'lms.factory.php';
require_once JPATH_SITE . DS . 'components' . DS . 'com_joomla_lms' . DS . "includes" . DS . "libraries" . DS . "lms.lib.language.php";
jimport('joomla.filesystem.folder');
$folders = JFolder::folders(JPATH_SITE . DS . 'administrator' . DS . 'components' . DS . 'com_joomla_lms' . DS . 'language');
$lang =& JFactory::getLanguage();
$locale = $lang->getLocale();
if ($folders && $locale) {
    $intersect = array_intersect($folders, $locale);
}
if (isset($intersect[0])) {
    $languageName = $intersect[0];
}
global $JLMS_LANGUAGE;
JLMS_require_lang($JLMS_LANGUAGE, 'admin.install.lang', $languageName, 'backend');
JLMS_processLanguage($JLMS_LANGUAGE, false, 'backend');
function com_install()
{
    $absolutePath = JPATH_SITE;
    $liveSite = substr_replace(JURI::root(), '', -1, 1);
    $database =& JFactory::getDBO();
    $JLMS_cfg_fms_url = '';
    $JLMS_cfg_fms_users = 0;
    $JLMS_cfg_fms_enabled = 0;
    $JLMS_default_language = 'english';
    $JLMS_help_link = 'http://www.joomlalms.com/index.php?option=com_lms_help&Itemid=40&task=view_by_task&key={toolname}';
    $version = new JVersion();
    function jlms_install_plugins()
    {
        // installation of JoomlaLMS plugins (plugins were added in 1.0.5)
        $absolutePath = JPATH_SITE;