public function update($assignment_id) { global $db; User::authRight('teacher'); $teacher_id = User::authService()['user_id']; $_PUT = GlobalFunction::getInput(); $data = $_PUT['form']; $code = $_PUT['code']; $parsedData = array(); foreach ($data as $d) { $parsedData[$d['name']] = $d['value']; } if (!isset($data)) { echo 1; die; } $deadline = date("Y-m-d H:i:s", strtotime($parsedData['due-date'] . $parsedData['due-time'])); $db->where('assignment_id', $assignment_id); $db->update('assignment', array('title' => $parsedData['title'], "course_id" => $parsedData['course-id'], "description" => $parsedData['description'], "deadline" => $deadline, "status" => $parsedData['status'], "grouping" => $parsedData['grouping'])); if (isset($code)) { require_once 'SampleCode.php'; $samplecode = new SampleCode(); $samplecode->manage($assignment_id, "update"); } else { echo 1; } }
public function manage($action, $editor_id = null) { global $db; $teacher_id = User::authService()['user_id']; $data = $_POST['code']; switch ($action) { case "create": break; case "delete": if (!GlobalFunction::isUserOwnEditor($editor_id)) { die('no auth'); } break; case "update": if (!isset($data)) { echo 1; die; } foreach ($data as $d) { $sample_code_id = substr($d['id'], 6); //echo $sample_code_id; $db->where('sample_code_id', $sample_code_id); $db->update("assignment_sample_code", array('assignment_id' => $assignment_id, 'code' => $d['editor'])); } echo 1; break; } }
public function actionSms() { $gf = new GlobalFunction(); $result = $gf->sendText('15210061902', '测试下内容'); var_dump($result); }
<?php require '../inc/WrapTable.php'; require '../inc/GlobalFunction.php'; // global funtion $func = new GlobalFunction(); // Start FPDF $pdf = new WrapTable(); $pdf->AddPage(); $pdf->SetFont('Arial', 'B', 12); // Set lebar kolom $pdf->SetWidths([20, 70, 50, 30]); // Set perataan kolom $pdf->SetAligns(['C', 'C', 'C', 'C']); // kolom $pdf->Row(['No.', 'Uraian', 'Jumlah', 'Ket']); // baris $pdf->SetAligns(['C', 'L', 'R', 'L']); $pdf->SetFont('Arial', '', 12); for ($i = 1; $i < 10; $i++) { $pdf->Row([$i, $func->GenerateSentence(), $i * rand(1, 100), $func->GenerateWord()]); } $pdf->Output();
<?php require '../inc/ImprovedTable.php'; require '../inc/GlobalFunction.php'; // global funtion $func = new GlobalFunction(); // Start FPDF $pdf = new ImprovedTable('P', 'mm', 'A4'); $pdf->AddPage(); $pdf->SetFont('Arial', 'B', 12); // tinggi maksimal $pdf->max_height = 40; // menggunakan column. default: false $pdf->show_cols = true; // Column Definite $cols = ["No." => 23, "Uraian" => 78, "Jumlah" => 22, "Kode" => 26, "Jenis" => 30, "Ket" => 11]; $pdf->addCols($cols); // Align Column $align = ["No." => "C", "Uraian" => "L", "Jumlah" => "C", "Kode" => "R", "Jenis" => "R", "Ket" => "C"]; $pdf->addLineFormat($align); // Row $pdf->SetFont('Arial', '', 12); $y = $pdf->GetY() + 8; // if using column $line = ["No." => "1", "Uraian" => $func->GenerateSentence(), "Jumlah" => "1", "Kode" => "600.00", "Jenis" => "600.00", "Ket" => "1"]; $size = $pdf->addLine($y, $line); $y += $size + 2; $line = ["No." => "2", "Uraian" => $func->GenerateSentence(), "Jumlah" => "1", "Kode" => "600.00", "Jenis" => "600.00", "Ket" => "1"]; $size = $pdf->addLine($y, $line); $y += $size + 2; /*