コード例 #1
0
 function add_save()
 {
     $title_cn = get_post_value('title_cn');
     $memo_cn = get_post_value('memo_cn');
     $orders = get_post_value('orders');
     $tips = get_post_value('tips');
     $start_time = get_post_value('start_time');
     $end_time = get_post_value('end_time');
     $status = get_post_value('status');
     $field = array('title_cn' => $title_cn, 'memo_cn' => $memo_cn, 'orders' => $orders, 'tips' => $tips, 'start_time' => $start_time, 'end_time' => $end_time, 'created' => date('Y-m-d H:i:s', time()), 'status' => '10000');
     $m = new Bulletin();
     $m->clear();
     $m->setTable('vcb_bulletin');
     //设置表名
     $m->setField($field);
     //设置更新字段及值,(键值数组)
     $data = $m->insert();
     //插入数据
     if (!$data) {
         //插入数据是否成功。
         echo '<br>保存失败<br>';
     } else {
         echo '<br>保存成功,<a href="add">继续添加</a>,<a href="index">返回</a><br>';
     }
 }
コード例 #2
0
ファイル: Bulletin.php プロジェクト: roger-jb/edeip
			}
			echo json_encode($bulletin->toArray());
			break;
		case 'addCommentaire':
			//idEleve: idEleve, idMatiere: idMatiere, idNiveau: idNiveau, idTrimestre:idTrimestre, idBulletin: idBulletin, commBulletin: commBulletin, action: 'addCommentaire'
			$trimestre = Trimestre::getById($_GET['idTrimestre']);
			$matiereNiveau = MatiereNiveau::getByMatiereNiveau($_GET['idMatiere'], $_GET['idNiveau']);
			$eleve = Eleve::getById($_GET['idEleve']);

			$bulletin = new Bulletin();
			if ($_GET['idBulletin'] == 0){
				$bulletin->setIdEleve($eleve->getIdUtilisateur());
				$bulletin->setIdMatiereNiveau($matiereNiveau->getIdMatiereNiveau());
				$bulletin->setContenuBulletin($_GET['commBulletin']);
				$bulletin->setDateRedacton(date('Y-m-d'));
				$bulletin->insert();
			}
			else {
				$bulletin = Bulletin::getById($_GET['idBulletin']);
				$bulletin->setContenuBulletin($_GET['commBulletin']);
				//$bulletin->setDateRedacton(date('Y-m-d'));
				$bulletin->update();
			}

			echo json_encode($bulletin->toArray());
			break;
		case 'addNivCpt' :
			//idEleve: idEleve, idTrimestre:idTrimestre, idPtCpt: idPtCpt, idNivCpt: idNivCpt, action: 'addNivCpt'
			$pointCptEleve = PointCptEleve::getById($_GET['idPtCpt'], $_GET['idEleve'], $_GET['idTrimestre']);

			// il n'existe pas, on le cr�e