public function indexAction($request) { $model = new myModel(); $sql = ""; $result = null; switch ($request) { case "school_university": $sql = "SELECT * FROM beauty_info\n\t\t\t\t\tWHERE (message LIKE '%技術學院%'\n\t\t\t\t\tOR message LIKE '%科技大學%'\n\t\t\t\t\tOR message LIKE '%科大%'\n\t\t\t\t\tOR message LIKE '%專科%' \n\t\t\t\t\tOR message LIKE '%專校%'\n\t\t\t\t\tOR message LIKE '%大學%') \n\t\t\t\t\tAND (message NOT LIKE '%北一女%'\n\t\t\t\t\tAND message NOT LIKE '%笑容以融化%'\n\t\t\t\t\tAND message NOT LIKE '%女中%'\n\t\t\t\t\tAND message NOT LIKE '%高中%'\n\t\t\t\t\tAND message NOT LIKE '%高職%'\n\t\t\t\t\tAND message NOT LIKE '%家商%'\n\t\t\t\t\tAND message NOT LIKE '%高商%'\n\t\t\t\t\tAND message NOT LIKE '%高一%'\n\t\t\t\t\tAND message NOT LIKE '%高二%'\n\t\t\t\t\tAND message NOT LIKE '%高三%'\n\t\t\t\t\tAND message NOT LIKE '%高工%'\n\t\t\t\t\tAND message NOT LIKE '%#127台灣大學歡迎大家推妹!!%'\n\t\t\t\t\tAND message NOT LIKE '%商職%'\n\t\t\t\t\tAND message NOT LIKE '%友站正妹推薦%'\n\t\t\t\t\tAND message NOT LIKE '%高級中學%'\n\t\t\t\t\tAND message NOT LIKE '%這裡有大學正妹%'\n\t\t\t\t\tAND message NOT LIKE '%畢業%')"; $result = $model->dispatchModel("getData", null, $sql); break; case "school_FJU": $sql = "SELECT * FROM beauty_FJU\n\t\t\t\t\t\tWHERE (message not LIKE '%男%' OR message LIKE '%女神%')\n\t\t\t\t\t\tAND LENGTH(message) <= 200 AND LENGTH(message) > 0\n\t\t\t\t\t\tAND (message NOT LIKE '%影傳四 影傳神丁 丁冠濠個性極佳 僑生之光%'\n\t\t\t\t\t\tAND message NOT LIKE '%光電三張永欣%'\n\t\t\t\t\t\tAND message NOT LIKE '%感謝熱心的同學提供小編%'\n\t\t\t\t\t\tAND message NOT LIKE '%曹佑寧%'\n\t\t\t\t\t\tAND message NOT LIKE '%余文樂%'\n\t\t\t\t\t\tAND message NOT LIKE '%帥%')"; $result = $model->dispatchModel("getData", null, $sql); break; case "colleges_university": $result = $model->dispatchModel("analytic", "university", null); break; case "colleges_FJU": $result = $model->dispatchModel("analytic", "FJU", null); break; default: $result = "invalid request string"; } return $result; }
public static function buildFormFromModel(myModel $object) { $form = new Form($object); $fields = []; foreach ($object->columnMap() as $column) { if (!in_array($column, ['created_at', 'updated_at', 'id'])) { $form->add(new \Phalcon\Forms\Element\Text($column)); $fields[] = $column; } } $form->fields = $fields; $form->add(new \Phalcon\Forms\Element\Submit('修改')); return $form; }
public function indexAction($request) { $model = new myModel(); $sql = ""; $result = null; switch ($request) { case "school_university": $sql = 'SELECT * FROM `beauty_info` WHERE (`message` LIKE "%技術學院%" OR `message` LIKE "%科技大學%" OR `message` LIKE "%科大%" OR `message` LIKE "%專科%" OR `message` LIKE "%專校%" OR `message` LIKE "%大學%") AND (`message` NOT LIKE "%北一女%" AND `message` NOT LIKE "%笑容以融化%" AND `message` NOT LIKE "%女中%" AND `message` NOT LIKE "%高中%" AND `message` NOT LIKE "%高職%" AND `message` NOT LIKE "%家商%" AND `message` NOT LIKE "%高商%" AND `message` NOT LIKE "%高一%" AND `message` NOT LIKE "%高二%" AND `message` NOT LIKE "%高三%" AND `message` NOT LIKE "%高工%" AND `message` NOT LIKE "%#127台灣大學歡迎大家推妹!!%" AND `message` NOT LIKE "%商職%" AND `message` NOT LIKE "%友站正妹推薦%" AND `message` NOT LIKE "%高級中學%" AND `message` NOT LIKE "%這裡有大學正妹%" AND `message` NOT LIKE "%畢業%")'; $result = $model->dispatchModel("getData", null, $sql); break; case "school_FJU": $sql = "SELECT * FROM `beauty_FJU`\n\t\t\t\t\t\tWHERE (`message` not LIKE '%男%' OR `message` LIKE '%女神%')\n\t\t\t\t\t\tAND LENGTH(`message`) <= 200 AND LENGTH(`message`) > 0\n\t\t\t\t\t\tAND (`message` NOT LIKE '%影傳四 影傳神丁 丁冠濠個性極佳 僑生之光%'\n\t\t\t\t\t\tAND `message` NOT LIKE '%光電三張永欣%'\n\t\t\t\t\t\tAND `message` NOT LIKE '%感謝熱心的同學提供小編%'\n\t\t\t\t\t\tAND `message` NOT LIKE '%曹佑寧%'\n\t\t\t\t\t\tAND `message` NOT LIKE '%余文樂%'\n\t\t\t\t\t\tAND `message` NOT LIKE '%帥%')"; $result = $model->dispatchModel("getData", null, $sql); break; case "colleges_university": $result = $model->dispatchModel("analytic", "university", null); break; case "colleges_FJU": $result = $model->dispatchModel("analytic", "FJU", null); break; default: $result = "invalid request string"; } return $result; }
public static function buildCommentForm(myModel $entity = null, Comments $comment = null) { if ($comment == null) { $form = new Form(); $form->add(new Submit('Add Comment')); if (null != $entity) { $form->Url = $entity->getAddCommentFormUrl(); } } else { $form = new Form($comment); $form->add(new Submit('修改')); } $content = new TextArea('content'); $content->addValidator(new PresenceOf(['message' => '评论内容不能为空'])); //这里也是一个增加验证的地方 $form->add($content); return $form; }
protected function buildFormFromModel(myModel $model) { if ($model->id) { $form = new Form($model); } else { $form = new Form(); } $fields = []; foreach ($model->columnMap() as $column) { if (!in_array($column, ['created_at', 'updated_at', 'id', 'password', 'remember_token'])) { $form->add(new \Phalcon\Forms\Element\Text($column)); $fields[] = $column; } } $form->fields = $fields; if ($model->id) { $form->add(new \Phalcon\Forms\Element\Submit('修改')); } else { $form->add(new \Phalcon\Forms\Element\Submit('增加')); } return $form; }
/** * Allows to query the first record that match the specified conditions * * @param mixed $parameters * @return Comments */ public static function findFirst($parameters = null) { return parent::findFirst($parameters); }
public function beforeSave() { EventFacade::fire('tags:updateTag', $this); return parent::beforeSave(); }