public function generatePickList()
    {
        App::import('Helper', 'Soap');
        $SoapHelper = new SoapHelper(new View(null));
        $test = $this->request->data['Linnworksapis']['orderid'];
        $skus = explode("---", $test);
        asort($skus);
        $skus = array_count_values($skus);
        $this->autoRender = false;
        $this->layout = '';
        $data = array();
        $index = 0;
        foreach ($skus as $key => $value) {
            $getData = $SoapHelper->getOrderById($key);
            foreach ($getData->GetFilteredOrdersResponse->GetFilteredOrdersResult->Orders->Order as $order) {
                foreach ($order->OrderItems->OrderItem as $item) {
                    $data[$index]['Qty'] = $item->Qty;
                    $data[$index]['ItemTitle'] = $item->ItemTitle;
                    $data[$index]['binrack'] = $item->Binrack;
                    $data[$index]['barcode'] = $item->Barcode;
                    $data[$index]['category'] = $item->Category;
                    $data[$index]['ChannelSKU'] = $item->SKU;
                    $data[$index]['PostalServiceName'] = $getData->GetFilteredOrdersResponse->GetFilteredOrdersResult->Orders->Order->PostalServiceName;
                    $index++;
                }
            }
        }
        $json = json_encode($data);
        $arrays = json_decode($json, TRUE);
        $ind = 0;
        foreach ($arrays as $array) {
            $dataNew[$ind]['Qty'] = $array['Qty'][0];
            $dataNew[$ind]['ItemTitle'] = $array['ItemTitle'][0];
            $dataNew[$ind]['binrack'] = isset($array['binrack'][0]) ? $array['binrack'][0] : 'null';
            $dataNew[$ind]['barcode'] = isset($array['barcode'][0]) ? $array['barcode'][0] : 'null';
            $dataNew[$ind]['ChannelSKU'] = isset($array['ChannelSKU'][0]) ? $array['ChannelSKU'][0] : 'null';
            $dataNew[$ind]['PostalServiceName'] = $array['PostalServiceName'][0];
            $ind++;
        }
        /* get the duplicaate value */
        $duplicatedata = $dataNew;
        foreach ($dataNew as $dataNewOuter => $dataNewOutervalue) {
            foreach ($dataNew as $dataNewInner => $dataNewInnervalue) {
                if ($dataNewOutervalue['ChannelSKU'] === $dataNewInnervalue['ChannelSKU']) {
                    if ($dataNewOuter != $dataNewInner) {
                        $duplicateValue[$dataNewInner] = $dataNewInnervalue['ChannelSKU'];
                    }
                }
            }
        }
        if (isset($duplicateValue) && count($duplicateValue) > 0) {
            $a = array_unique($duplicateValue);
            $duplicateArray = $dataNew;
            foreach ($duplicateValue as $key => $value) {
                unset($dataNew[$key]);
            }
            sort($dataNew);
            $result = array_merge($dataNew, $a);
        } else {
            $result = $duplicatedata;
        }
        $e = 0;
        $r = 0;
        foreach ($result as $keyIndex => $keyValue) {
            $csvData[$r]['Qty'] = 0;
            foreach ($duplicatedata as $dupIndex => $dupValue) {
                if (isset($keyValue['ChannelSKU'])) {
                    if ($keyValue['ChannelSKU'] == $dupValue['ChannelSKU']) {
                        $csvData[$r]['Qty'] = $dupValue['Qty'];
                        $csvData[$r]['ItemTitle'] = $dupValue['ItemTitle'];
                        $csvData[$r]['binrack'] = $dupValue['binrack'];
                        $csvData[$r]['barcode'] = $dupValue['barcode'];
                        $csvData[$r]['ChannelSKU'] = $dupValue['ChannelSKU'];
                    }
                }
                if (isset($keyValue)) {
                    if ($keyValue == $dupValue['ChannelSKU']) {
                        $csvData[$r]['Qty'] = $csvData[$r]['Qty'] + $dupValue['Qty'];
                        $csvData[$r]['ItemTitle'] = $dupValue['ItemTitle'];
                        $csvData[$r]['binrack'] = $dupValue['binrack'];
                        $csvData[$r]['barcode'] = $dupValue['barcode'];
                        $csvData[$r]['ChannelSKU'] = $dupValue['ChannelSKU'];
                    }
                }
            }
            $r++;
        }
        App::import('Vendor', 'tcpdf/tcpdf');
        $pdf = new tcpdf(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
        $date = date("Y-m-d");
        $pdf->SetCreator(PDF_CREATOR);
        //$pdf->SetAuthor('Nicola Asuni');
        //$pdf->SetTitle('TCPDF Example 006');
        //$pdf->SetSubject('TCPDF Tutorial');
        //$pdf->SetKeywords('TCPDF, PDF, example, test, guide');
        // set default header data
        //$pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, 'Pick List '.$date, PDF_HEADER_STRING);
        $pdf->SetHeaderData('', '', 'Pick List ' . $date, '');
        // set header and footer fonts
        $pdf->setHeaderFont(array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));
        $pdf->setFooterFont(array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA));
        // set default monospaced font
        $pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);
        // set margins
        $pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);
        $pdf->SetHeaderMargin(PDF_MARGIN_HEADER);
        $pdf->SetFooterMargin(PDF_MARGIN_FOOTER);
        // set auto page breaks
        $pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
        $pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
        if (@file_exists(dirname(__FILE__) . '/lang/eng.php')) {
            require_once dirname(__FILE__) . '/lang/eng.php';
            $pdf->setLanguageArray($l);
        }
        $pdf->SetFont('times', '', 8);
        $pdf->AddPage();
        $j = 0;
        foreach ($csvData as $csvdata) {
            $j = $j + $csvdata['Qty'];
        }
        $html = '<h2>Total SKU  : - ' . $j . '</h2>
				<table border="1" width="110%" >
					<tr>
						<th width="5%" align="center">S.No</th>
						<th width="20%" align="center">SKU</th>
						<th width="45%" align="center">Qty / Item Title</th>
						<th width="5%" align="center">Qty</th>
						<th width="5%" align="center">Bin Rack</th>
						<th width="10%" align="center" >BarCode</th>
					</tr>';
        $i = 1;
        foreach ($csvData as $csvdata) {
            $html .= '<tr>
						<td align="center">' . $i . '</td>
						<td>' . $csvdata['ChannelSKU'] . '</td>
						<td align="left"><b>' . $csvdata['Qty'] . '</b> X ' . $csvdata['ItemTitle'] . '</td>
						<td align="center">' . $csvdata['Qty'] . '</td>
						<td >' . $csvdata['binrack'] . '</td>
						<td>' . $csvdata['barcode'] . '</td>
					</tr>';
            $i++;
        }
        $html .= '</table>';
        $pdf->writeHTML($html, true, false, true, false, '');
        $js = 'print(true);';
        $pdf->IncludeJS($js);
        $pdf->Output('Pick_List_' . $date . '.pdf', 'D');
    }
require 'modules/config.php';
if (!isset($_GET["id"])) {
    exit("Missing Parameters...");
}
require_once 'pdf/tcpdf.php';
$pdf = new tcpdf(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
$pdf->SetCreator(PDF_CREATOR);
$pdf->SetAuthor('shuttleconcierge');
$pdf->SetTitle('confirmacion');
$pdf->SetSubject('confirmacion');
$pdf->SetHeaderData('logo.jpg', 100, 'Reservation Confirmation', "www.shuttleconcierge.com\nPhone. 01800 890 5878\nemail: contacto@shuttleconcierge.com", array(0, 64, 255), array(0, 64, 128));
$pdf->setFooterData(array(0, 64, 0), array(0, 64, 128));
$pdf->setHeaderFont(array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));
$pdf->setFooterFont(array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA));
$pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);
$pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);
$pdf->SetHeaderMargin(PDF_MARGIN_HEADER);
$pdf->SetFooterMargin(PDF_MARGIN_FOOTER);
$pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
$pdf->setFontSubsetting(true);
$pdf->SetFont('dejavusans', '', 14, '', true);
$pdf->AddPage();
$mysqli = new mysqli($db_host, $db_user, $db_password, $db_name);
if ($mysqli->connect_errno) {
    printf("Connection Failure: %s\n", $mysqli->connect_error);
    exit;
}
$mysqli->set_charset("utf8");
if ($resultado = $mysqli->query("\n\t\t\tSELECT *\n\t\t\tFROM bookings\n\t\t\tWHERE book_id = " . $_GET["id"] . "")) {
    $data = $resultado->fetch_all(MYSQLI_ASSOC);
 function view()
 {
     global $CFG, $USER, $DB, $OUTPUT, $PAGE;
     $edit = optional_param('edit', 0, PARAM_BOOL);
     $saved = optional_param('saved', 0, PARAM_BOOL);
     $print = optional_param('print', 0, PARAM_BOOL);
     $context = context_module::instance($this->cm->id);
     require_capability('mod/assignment:view', $context);
     $submission = $this->get_submission();
     //We added an extra field to the submissions table, for feedback using video or audio
     //and this was where we added it. But we will no longer do this in PoodLL 2. It was hacky.
     //can just drop in a video from a recording repo if want to do this.  But never say never so
     //am leaving the code around. Justin 20120302
     if (false && $submission) {
         $dbman = $DB->get_manager();
         $table = new xmldb_table('assignment_submissions');
         if (!$dbman->field_exists($table, 'poodllfeedback')) {
             $field = new xmldb_field('poodllfeedback', XMLDB_TYPE_TEXT, 'medium', null, null, null, null, null);
             $result = $dbman->add_field($table, $field);
         }
     }
     //Justin
     //Are we printing this or not
     if ($print) {
         if (TCPPDF_OLD) {
             require_once $CFG->libdir . '/tcpdf/tcpdf.php';
         } else {
             require_once $CFG->libdir . '/newtcpdf/tcpdf.php';
         }
         $pdf = new tcpdf(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true);
         // remove default header/footer
         //old version of tcppdf
         if (TCPPDF_OLD) {
             $pdf->print_header = false;
             $pdf->print_footer = false;
         } else {
             //new version of tcppdf
             $pdf->setPrintHeader(false);
             $pdf->setPrintFooter(false);
         }
         //set margins
         $pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);
         //set auto page breaks
         $pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
         $pdf->setFont('freeserif', '', 10);
         //make page
         $pdf->AddPage();
         //prepare html content
         $options = new object();
         $options->smiley = false;
         $options->filter = false;
         $strHtml = format_text($submission->data1, FORMAT_HTML, $options);
         //print the thing
         $pdf->writeHTML($strHtml, true, 0, true, 0);
         //The I is for inline, meaning tell the browser to shopw not download it.
         $pdf->output('document.pdf', 'I');
         //$pdf->output();
         return;
     }
     //Guest can not submit nor edit an assignment (bug: 4604)
     if (!has_capability('mod/assignment:submit', $context)) {
         $editable = null;
     } else {
         $editable = $this->isopen() && (!$submission || $this->assignment->resubmit || !$submission->timemarked);
     }
     //modify Justin 20090305, we don't want to add this extra step for users.
     //If they can edit, and they haven't submitted anything, then lets just show the form.
     //If they have submitted something, lets give them an extra step if ytthey want to submit
     //to protect accidental overwrite of their submission.
     // $editmode = ($editable and $edit);
     $editmode = ($editable and !$submission || $edit);
     if ($editmode) {
         //guest can not edit or submit assignment
         if (!has_capability('mod/assignment:submit', $context)) {
             print_error('guestnosubmit', 'assignment');
         }
     }
     add_to_log($this->course->id, "assignment", "view", "view.php?id={$this->cm->id}", $this->assignment->id, $this->cm->id);
     /// prepare form and process submitted data
     //load it with some info it needs to determine the params for PoodLL recorder.
     //for voice then text, we need to know if we already have voice or not
     if (empty($submission)) {
         $mediapath = "";
     } else {
         $mediapath = $submission->data2;
     }
     $data = new stdClass();
     $data->id = $this->cm->id;
     $data->edit = 1;
     if ($submission) {
         $data->sid = $submission->id;
         $data->text = $submission->data1;
         $data->textformat = FORMAT_HTML;
     } else {
         $data->sid = NULL;
         $data->text = '';
         $data->textformat = FORMAT_HTML;
     }
     $editoroptions = array('noclean' => false, 'maxfiles' => EDITOR_UNLIMITED_FILES, 'maxbytes' => $this->course->maxbytes, 'context' => $this->context);
     $data = file_prepare_standard_editor($data, 'text', $editoroptions, $this->context, 'mod_assignment', $this->filearea, $data->sid);
     $mform = new mod_assignment_poodllonline_edit_form(null, array("cm" => $this->cm, "assignment" => $this->assignment, "mediapath" => $mediapath, "data" => $data, "editoroptions" => $editoroptions));
     if ($mform->is_cancelled()) {
         redirect($PAGE->url);
     }
     if ($data = $mform->get_data()) {
         $submission = $this->get_submission($USER->id, true);
         //create the submission if needed & its id
         //this step is only required if we are using a text editor, it is to move drft files over Justin 20120208
         if ($this->assignment->var3 == OM_REPLYTEXTONLY) {
             $data = file_postupdate_standard_editor($data, 'text', $editoroptions, $this->context, 'mod_assignment', $this->filearea, $submission->id);
         }
         $submission = $this->update_submission($data);
         //TODO fix log actions - needs db upgrade
         add_to_log($this->course->id, 'assignment', 'upload', 'view.php?a=' . $this->assignment->id, $this->assignment->id, $this->cm->id);
         $this->email_teachers($submission);
         //redirect to get updated submission date and word count
         redirect(new moodle_url($PAGE->url, array('saved' => 1)));
     }
     /// print header, etc. and display form if needed
     if ($editmode) {
         $this->view_header(get_string('editmysubmission', 'assignment'));
     } else {
         $this->view_header();
     }
     $this->view_intro();
     $this->view_dates();
     if ($saved) {
         notify(get_string('submissionsaved', 'assignment'), 'notifysuccess');
     }
     if (has_capability('mod/assignment:submit', $context)) {
         echo $OUTPUT->box_start('generalbox boxaligncenter', 'poodllonline');
         // print_simple_box_start('center', '70%', '', 0, 'generalbox', 'poodllonline');
         if ($editmode) {
             if ($submission) {
                 //Show our  students answer box
                 echo get_string('mysubmission', 'assignment_poodllonline');
                 echo $OUTPUT->box_start('generalbox boxaligncenter', 'mysubmission');
                 //print_simple_box_start('center', '50%', '', 0, 'generalbox', 'mysubmission');
                 echo $this->fetchResponses($this->context->id, $submission->id, $this->assignment->var3, $submission->data1, $submission->data2, false, false, false);
                 //Close our students answer box
                 //print_simple_box_end();
                 echo $OUTPUT->box_end();
             }
             $mform->display();
         } else {
             if ($submission) {
                 //Show our  students answer box
                 echo get_string('mysubmission', 'assignment_poodllonline');
                 echo $OUTPUT->box_start('generalbox boxaligncenter', 'mysubmission');
                 //print_simple_box_start('center', '50%', '', 0, 'generalbox', 'mysubmission');
                 echo $this->fetchResponses($this->context->id, $submission->id, $this->assignment->var3, $submission->data1, $submission->data2, false, false, false);
                 //Close out students answer box
                 //print_simple_box_end();
                 echo $OUTPUT->box_end();
             } else {
                 if (!has_capability('mod/assignment:submit', $context)) {
                     //fix for #4604
                     echo '<div style="text-align:center">' . get_string('guestnosubmit', 'assignment') . '</div>';
                 } else {
                     if ($this->isopen()) {
                         //fix for #4206
                         echo '<div style="text-align:center">' . get_string('emptysubmission', 'assignment') . '</div>';
                     }
                 }
             }
         }
         // print_simple_box_end();
         echo $OUTPUT->box_end();
         if (!$editmode && $editable) {
             echo "<div style='text-align:center'>";
             //this method is deprecated , we now use $OUTPUT  Justin 20110602
             //  print_single_button('view.php', array('id'=>$this->cm->id,'edit'=>'1'),
             //          get_string('editmysubmission', 'assignment'));
             echo $OUTPUT->single_button('view.php?id=' . $this->cm->id . '&edit=1', get_string('editmysubmission', 'assignment'));
             echo "</div>";
         }
         //show a print buttonif it is text only and not edit mode
         if ($this->assignment->var3 == OM_REPLYTEXTONLY && !$editmode) {
             echo "<br /><div style='text-align:center'>";
             echo "<a href='view.php?id=" . $this->cm->id . "&print=1' target='_new'>" . get_string('printthissubmission', 'assignment_poodllonline') . "</a>";
             //The target tag is ignored by print_single_button so not using it
             //print_single_button('view.php', array('id'=>$this->cm->id,'print'=>'1'),get_string('printthissubmission', 'assignment_poodllonline'),'get','_new');
             echo "</div>";
         }
         //end of if printable
     }
     //end of if can submit
     $this->view_feedback();
     $this->view_footer();
 }
Esempio n. 4
0
 function view()
 {
     global $CFG, $USER;
     $edit = optional_param('edit', 0, PARAM_BOOL);
     $saved = optional_param('saved', 0, PARAM_BOOL);
     $print = optional_param('print', 0, PARAM_BOOL);
     $context = get_context_instance(CONTEXT_MODULE, $this->cm->id);
     require_capability('mod/assignment:view', $context);
     $submission = $this->get_submission();
     //We need to add an extra field to the submissions table, for feedback using video or audio
     //we check if it exists here, and if not we add it. Justin 20100324
     if ($submission) {
         if (!column_type('assignment_submissions', 'poodllfeedback')) {
             // add field to store media comments (audio or video) filename to students submissions
             $sql = "ALTER TABLE " . $CFG->prefix . "assignment_submissions ADD poodllfeedback TEXT";
             $result = execute_sql($sql);
         }
     }
     //Justin
     //Are we printing this or not
     if ($print) {
         if (TCPPDF_OLD) {
             require_once $CFG->libdir . '/tcpdf/tcpdf.php';
         } else {
             require_once $CFG->libdir . '/newtcpdf/tcpdf.php';
         }
         $pdf = new tcpdf(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true);
         // remove default header/footer
         //old version of tcppdf
         if (TCPPDF_OLD) {
             $pdf->print_header = false;
             $pdf->print_footer = false;
         } else {
             //new version of tcppdf
             $pdf->setPrintHeader(false);
             $pdf->setPrintFooter(false);
         }
         //set margins
         $pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);
         //set auto page breaks
         $pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
         $pdf->setFont('freeserif', '', 10);
         //make page
         $pdf->AddPage();
         //prepare html content
         $options = new object();
         $options->smiley = false;
         $options->filter = false;
         $strHtml = format_text($submission->data1, FORMAT_HTML, $options);
         //print the thing
         $pdf->writeHTML($strHtml, true, 0, true, 0);
         //The I is for inline, meaning tell the browser to shopw not download it.
         $pdf->output('document.pdf', 'I');
         //$pdf->output();
         return;
     }
     //Guest can not submit nor edit an assignment (bug: 4604)
     if (!has_capability('mod/assignment:submit', $context)) {
         $editable = null;
     } else {
         $editable = $this->isopen() && (!$submission || $this->assignment->resubmit || !$submission->timemarked);
     }
     //modify Justin 20090305, we don't want to add this extra step for users.
     //If they can edit, and they haven't submitted anything, then lets just show the form.
     //If they have submitted something, lets give them an extra step if ytthey want to submit
     //to protect accidental overwrite of their submission.
     // $editmode = ($editable and $edit);
     $editmode = ($editable and !$submission || $edit);
     if ($editmode) {
         //guest can not edit or submit assignment
         if (!has_capability('mod/assignment:submit', $context)) {
             print_error('guestnosubmit', 'assignment');
         }
     }
     add_to_log($this->course->id, "assignment", "view", "view.php?id={$this->cm->id}", $this->assignment->id, $this->cm->id);
     /// prepare form and process submitted data
     //load it with some info it needs to determine the params for chosho recorder.
     //for voice then text, we need to know if we already have voice or not
     if (empty($submission)) {
         $mediapath = "";
     } else {
         $mediapath = $submission->data2;
     }
     $mform = new mod_assignment_poodllonline_edit_form(null, array("cm" => $this->cm, "assignment" => $this->assignment, "mediapath" => $mediapath));
     $defaults = new object();
     $defaults->id = $this->cm->id;
     if (!empty($submission)) {
         //we always use html editor: Justin 20090225
         //if ($this->usehtmleditor) {
         if (true) {
             $options = new object();
             $options->smiley = false;
             $options->filter = false;
             $defaults->text = format_text($submission->data1, FORMAT_HTML, $options);
             $defaults->format = FORMAT_HTML;
         } else {
             $defaults->text = $submission->data1;
             $defaults->format = $submission->data2;
         }
     }
     $mform->set_data($defaults);
     if ($mform->is_cancelled()) {
         redirect('view.php?id=' . $this->cm->id);
     }
     if ($data = $mform->get_data()) {
         // No incoming data?
         if ($editable && $this->update_submission($data)) {
             //TODO fix log actions - needs db upgrade
             $submission = $this->get_submission();
             add_to_log($this->course->id, 'assignment', 'upload', 'view.php?a=' . $this->assignment->id, $this->assignment->id, $this->cm->id);
             $this->email_teachers($submission);
             //redirect to get updated submission date and word count
             redirect('view.php?id=' . $this->cm->id . '&saved=1');
         } else {
             // TODO: add better error message
             notify(get_string("error"));
             //submitting not allowed!
         }
     }
     /// print header, etc. and display form if needed
     if ($editmode) {
         $this->view_header(get_string('editmysubmission', 'assignment'));
     } else {
         $this->view_header();
     }
     $this->view_intro();
     $this->view_dates();
     if ($saved) {
         notify(get_string('submissionsaved', 'assignment'), 'notifysuccess');
     }
     if (has_capability('mod/assignment:submit', $context)) {
         print_simple_box_start('center', '70%', '', 0, 'generalbox', 'poodllonline');
         if ($editmode) {
             if ($submission) {
                 //Show our  students answer box
                 echo get_string('mysubmission', 'assignment_poodllonline');
                 print_simple_box_start('center', '50%', '', 0, 'generalbox', 'mysubmission');
                 //check if we need media output
                 switch ($this->assignment->var3) {
                     case OM_REPLYVOICEONLY:
                         //format and echo text that our Audio filter will pick and show in a player
                         //needs to be formatted as html for filter to pick it up
                         //echo format_text('{FMS:VOICE='.	$submission->data2.'}', FORMAT_HTML);
                         echo format_text('{POODLL:type=audio,path=' . $submission->data2 . ',protocol=rtmp}', FORMAT_HTML);
                         break;
                     case OM_REPLYVIDEOONLY:
                         //format and echo text that our Video filter will pick and show in a player
                         //needs to be formatted as html for filter to pick it up
                         //echo format_text('{FMS:VIDEO='.	$submission->data2.'}', FORMAT_HTML);
                         echo format_text('{POODLL:type=video,path=' . $submission->data2 . ',protocol=rtmp}', FORMAT_HTML);
                         break;
                     case OM_REPLYVOICETHENTEXT:
                         //format and echo text that our Audio filter will pick and show in a player
                         //needs to be formatted as html for filter to pick it up
                         //echo format_text('{FMS:VOICE='.	$submission->data2.'}', FORMAT_HTML);
                         echo format_text('{POODLL:type=audio,path=' . $submission->data2 . ',protocol=rtmp}', FORMAT_HTML);
                         break;
                     case OM_REPLYVIDEOTHENTEXT:
                         //format and echo text that our Video filter will pick and show in a player
                         //needs to be formatted as html for filter to pick it up
                         //echo format_text('{FMS:VIDEO='.	$submission->data2.'}', FORMAT_HTML);
                         echo format_text('{POODLL:type=video,path=' . $submission->data2 . ',protocol=rtmp}', FORMAT_HTML);
                         break;
                 }
                 //check if we need text output
                 switch ($this->assignment->var3) {
                     case OM_REPLYVOICETHENTEXT:
                     case OM_REPLYVIDEOTHENTEXT:
                         if (empty($submission->data1)) {
                             break;
                         } else {
                             echo "<br />";
                         }
                     case OM_REPLYTEXTONLY:
                     default:
                         echo format_text($submission->data1, FORMAT_HTML);
                 }
                 //Close our students answer box
                 print_simple_box_end();
             }
             $mform->display();
         } else {
             if ($submission) {
                 //Show our  students answer box
                 echo get_string('mysubmission', 'assignment_poodllonline');
                 print_simple_box_start('center', '50%', '', 0, 'generalbox', 'mysubmission');
                 switch ($this->assignment->var3) {
                     case OM_REPLYVOICEONLY:
                         //format and echo text that our Audio filter will pick and show in a player
                         //needs to be formatted as html for filter to pick it up
                         //echo format_text('{FMS:VOICE='.	$submission->data2.'}', FORMAT_HTML);
                         echo format_text('{POODLL:type=audio,path=' . $submission->data2 . ',protocol=rtmp}', FORMAT_HTML);
                         break;
                     case OM_REPLYVIDEOONLY:
                         //format and echo text that our Video filter will pick and show in a player
                         //needs to be formatted as html for filter to pick it up
                         //echo format_text('{FMS:VIDEO='.	$submission->data2.'}', FORMAT_HTML);
                         echo format_text('{POODLL:type=video,path=' . $submission->data2 . ',protocol=rtmp}', FORMAT_HTML);
                         break;
                     case OM_REPLYVOICETHENTEXT:
                         //format and echo text that our Audio filter will pick and show in a player
                         //needs to be formatted as html for filter to pick it up
                         //echo format_text('{FMS:VOICE='.	$submission->data2.'}', FORMAT_HTML);
                         echo format_text('{POODLL:type=audio,path=' . $submission->data2 . ',protocol=rtmp}', FORMAT_HTML);
                         break;
                     case OM_REPLYVIDEOTHENTEXT:
                         //format and echo text that our Video filter will pick and show in a player
                         //needs to be formatted as html for filter to pick it up
                         //echo format_text('{FMS:VIDEO='.	$submission->data2.'}', FORMAT_HTML);
                         echo format_text('{POODLL:type=video,path=' . $submission->data2 . ',protocol=rtmp}', FORMAT_HTML);
                         break;
                 }
                 //check if we need text output
                 switch ($this->assignment->var3) {
                     case OM_REPLYVOICETHENTEXT:
                     case OM_REPLYVIDEOTHENTEXT:
                         if (empty($submission->data1)) {
                             break;
                         } else {
                             echo "<br />";
                         }
                     case OM_REPLYTEXTONLY:
                     default:
                         echo format_text($submission->data1, FORMAT_HTML);
                 }
                 //Close out students answer box
                 print_simple_box_end();
             } else {
                 if (!has_capability('mod/assignment:submit', $context)) {
                     //fix for #4604
                     echo '<div style="text-align:center">' . get_string('guestnosubmit', 'assignment') . '</div>';
                 } else {
                     if ($this->isopen()) {
                         //fix for #4206
                         echo '<div style="text-align:center">' . get_string('emptysubmission', 'assignment') . '</div>';
                     }
                 }
             }
         }
         print_simple_box_end();
         if (!$editmode && $editable) {
             echo "<div style='text-align:center'>";
             print_single_button('view.php', array('id' => $this->cm->id, 'edit' => '1'), get_string('editmysubmission', 'assignment'));
             echo "</div>";
         }
         //show a print buttonif it is text only and not edit mode
         if ($this->assignment->var3 == OM_REPLYTEXTONLY && !$editmode) {
             echo "<br /><div style='text-align:center'>";
             echo "<a href='view.php?id=" . $this->cm->id . "&print=1' target='_new'>" . get_string('printthissubmission', 'assignment_poodllonline') . "</a>";
             //The target tag is ignored by print_single_button so not using it
             //print_single_button('view.php', array('id'=>$this->cm->id,'print'=>'1'),get_string('printthissubmission', 'assignment_poodllonline'),'get','_new');
             echo "</div>";
         }
         //end of if printable
     }
     //end of if can submit
     $this->view_feedback();
     $this->view_footer();
 }