Beispiel #1
0
| Here is where you can register all of the routes for an application.
| It's a breeze. Simply tell Laravel the URIs it should respond to
| and give it the controller to call when that URI is requested.
|
*/
Route::get('/', function () {
    session::regenerate();
    session::put("name", "haitham");
    if (!session::has("name")) {
        return redirect('user/unauthenticated');
    }
    return view('login');
});
Route::get('/users', "testcontroller@allusers");
Route::get('/employee', function () {
    return view('employee');
});
Route::get('test', function () {
    $phpWord = new \PhpOffice\PhpWord\PhpWord();
    $section = $phpWord->createSection();
    $section->addText('Hello World!');
    $file = 'HelloWorld.docx';
    header("Content-Description: File Transfer");
    header('Content-Disposition: attachment; filename="' . $file . '"');
    header('Content-Type: application/vnd.openxmlformats-officedocument.wordprocessingml.document');
    header('Content-Transfer-Encoding: binary');
    header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
    header('Expires: 0');
    $xmlWriter = \PhpOffice\PhpWord\IOFactory::createWriter($phpWord, 'Word2007');
    $xmlWriter->save("php://output");
});
Beispiel #2
0
$kodH = $kodH ? $kodH : "..............";
$onayH = $onayH ? $onayH : "..............";
$revH = $revH == '00' || $revH == '0' ? '...' : $revH;
//Bilgiler Son
// New Word Document
// Baslik Style
$phpWord->addFontStyle('rBasStyle', array('bold' => true, 'name' => 'Times New Roman', 'size' => 14));
$phpWord->addParagraphStyle('pBasStyle', array('align' => 'center', 'spaceAfter' => 100));
//İçerik Style
$phpWord->addFontStyle('rIcStyle', array('name' => 'Times New Roman', 'size' => 12));
$phpWord->addParagraphStyle('pIcStyle', array('align' => 'center', 'spaceAfter' => 100));
//İçerikBas Style
$phpWord->addFontStyle('rIcBasStyle', array('name' => 'Times New Roman', 'size' => 12, 'bold' => true));
$phpWord->addParagraphStyle('pIcStyle', array('align' => 'center', 'spaceAfter' => 100));
// New portrait section
$section = $phpWord->createSection(array('orientation' => 'portrait'));
//   Kapak
$section->addImage('images/myk_logo.jpg', array('width' => 152, 'height' => 187, 'align' => 'center'));
$section->addTextBreak(3);
$section->addText('ULUSAL MESLEK STANDARDI', 'rBasStyle', 'pBasStyle');
$section->addTextBreak(3);
$section->addText($std, 'rBasStyle', 'pBasStyle');
$section->addText($seviye, 'rBasStyle', 'pBasStyle');
$section->addTextBreak(2);
$section->addText('REFERANS KODU / ' . $bilgi['STANDART_KODU'], 'rBasStyle', 'pBasStyle');
$section->addTextBreak(1);
$section->addText('RESMİ GAZETE TARİH-SAYI / ' . $resmi, 'rBasStyle', 'pBasStyle');
//   Kapak Son
//footer
$paraStyle = array('bold' => true, 'align' => 'center');
$phpWord->addParagraphStyle('leftHeadStyle', array('align' => 'left', 'spaceBefore' => 0, 'spaceAfter' => 0, 'spacing' => 0));
Beispiel #3
0
 function exportResultStudent($student, $topic, $student_mark_id = 0)
 {
     $CI =& get_instance();
     $topic = (object) $topic;
     ob_start();
     $CI->load->library('stringobj');
     $CI->load->library('utils');
     $CI->load->library('commonobj');
     $CI->load->model('student_answer_model');
     $CI->load->model('topic_model');
     $CI->load->model('topic_file_model');
     $student_id = $student->student_id;
     $student_name = $student->fullname;
     $indentity_number = $student->indentity_number;
     $student_id = intval($student_id);
     $data = array('topic_manage_id' => $topic->topic_manage_id, 'class_id' => $student->class_id);
     $folderName = $CI->commonobj->encrypt(implode(',', $data));
     $file_path = PATH_FILES_NO_ROOT . $folderName;
     if (!file_exists($file_path)) {
         mkdir($file_path, 0777);
     }
     $data['folder_name'] = $folderName;
     $CI->topic_file_model->create_ignore($data);
     $file_path .= '/';
     $filename = $file_path . $CI->stringobj->createAlias($student_name, '-') . '-' . $indentity_number . '-' . date('dmYHis') . DOCX;
     $answers_student = $CI->student_answer_model->getAnswerOfStudentId($student_id, $topic->topic_id, $student_mark_id);
     $studentAnswerList = $CI->utils->makeList('question_id', $answers_student);
     $topicDetails = $CI->topic_model->getData($topic->topic_id);
     // Include the PHPWord.php, all other classes were loaded by an autoloader
     require_once APPPATH . 'libraries/PhpOffice/PhpWord/PHPWord.php';
     // New Word Document
     $PHPWord = new \PhpOffice\PhpWord\PhpWord();
     // New portrait section
     $section = $PHPWord->createSection();
     $styleTable = array('borderSize' => 6, 'borderColor' => '006699', 'cellMargin' => 80);
     // Add table style
     $PHPWord->addParagraphStyle('pStyle', array('lineHeight' => 2));
     $PHPWord->addTableStyle('myOwnTableStyle', $styleTable);
     $this->_writeInfoStudent($section, $student, $topic);
     $this->_writeAnswerOfStudent($section, $answers_student);
     $this->_writeAnswerOfStudentDetail($section, $studentAnswerList, $topicDetails);
     // write docx
     $xmlWriter = IOFactory::createWriter($PHPWord, 'Word2007');
     $xmlWriter->save($filename);
 }