当前位置: 首页>>代码示例>>PHP>>正文


PHP Action::save方法代码示例

本文整理汇总了PHP中Action::save方法的典型用法代码示例。如果您正苦于以下问题:PHP Action::save方法的具体用法?PHP Action::save怎么用?PHP Action::save使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Action的用法示例。


在下文中一共展示了Action::save方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: logAction

 public static function logAction($user, $key, $details = null)
 {
     $action = new Action();
     $action->setUser($user);
     $action->setKey($key);
     if (!empty($details)) {
         $action->setDetails($details);
     }
     $action->setActionTime(time());
     $action->save();
 }
开发者ID:shelsonjava,项目名称:datawrapper,代码行数:11,代码来源:Action.php

示例2: createDefaultActions

 public function createDefaultActions($post_id, $p_type)
 {
     for ($i = 1; $i <= ACTIONS_COUNT; $i++) {
         $action = new Action();
         $action->user_id = Session::get('current_user');
         $action->a_type = $i;
         $action->post_id = $post_id;
         $action->p_type = $p_type;
         $action->save();
     }
 }
开发者ID:huuson94,项目名称:btlwebapp,代码行数:11,代码来源:ActionsController.php

示例3: initActions

 public static function initActions()
 {
     $actions = (include Yii::app()->basePath . '/config-dist/actions.php');
     foreach ($actions as $k => $v) {
         $action = new Action();
         $ret = $action->find('aname=:name', array(':name' => $v['aname']));
         if (empty($ret)) {
             $action->aname = $v['aname'];
             $action->route = $v['route'];
             $action->is_menu = $v['is_menu'];
             $action->save();
         }
     }
 }
开发者ID:jinchunguang,项目名称:backadmin_yii,代码行数:14,代码来源:InitSystem.php

示例4: logAction

 public static function logAction($user, $key, $details = null)
 {
     $action = new Action();
     $action->setUser($user);
     $action->setKey($key);
     if (!empty($details)) {
         if (!is_numeric($details) && !is_string($details)) {
             $details = json_encode($details);
         }
         $action->setDetails($details);
     }
     $action->setActionTime(time());
     $action->save();
 }
开发者ID:Halfnhav4,项目名称:datawrapper,代码行数:14,代码来源:Action.php

示例5: process

 public function process($get, $post)
 {
     if (!isset($post['course_id']) || !is_numeric($post['course_id']) || !isset($_COOKIE['sessionId']) || !is_numeric($_COOKIE['sessionId'])) {
         $this->failureReason = 'Sorry, there was an error.';
         return false;
     }
     $query = new Query('action');
     // Select all the courses that are in this user's session and have this course id
     $result = $query->select('*', array(array('course_id', '=', $post['course_id']), array('session_id', '=', $_COOKIE['sessionId'])), '', 1);
     if (count($result) != 0) {
         // Abort because this course is already in the user's model
         $this->failureReason = 'Sorry, there was an error';
         return false;
     }
     // Now add this course to the user's model
     $action = new Action();
     $action->set('course_id', $post['course_id']);
     $action->set('session_id', $_COOKIE['sessionId']);
     $action->save();
     return true;
 }
开发者ID:bennyty,项目名称:suggestr,代码行数:21,代码来源:AddCourse.php

示例6: run

 public function run()
 {
     $key_door = new Action();
     $key_door->item_1 = 'key';
     $key_door->item_2 = 'door';
     $key_door->location = 2;
     $key_door->result = 'The door unlocks and swings open. You can now go east into the tower.';
     $key_door->save();
     $lantern_hay = new Action();
     $lantern_hay->item_1 = 'lantern';
     $lantern_hay->item_2 = 'hay';
     $lantern_hay->location = 7;
     $lantern_hay->result = 'You stick some hay into the lantern. As it catches fire you drop it all on the rest of the hay, the fire is spreading quickly and you can hear the gaurds coming to invesigate. You should sneak off while they are disracted.';
     $lantern_hay->save();
     $wine_guard = new Action();
     $wine_guard->item_1 = 'wine';
     $wine_guard->item_2 = 'guard';
     $wine_guard->location = 20;
     $wine_guard->result = 'You quietly place the wine against the wall where the gaurds can see it. After a little they pick it up, and being bored, start to drink. A few moments later they sucumb to their fatigue and fall into a drunken stupor';
     $wine_guard->save();
 }
开发者ID:Borq-Gaming,项目名称:borq.dev,代码行数:21,代码来源:ActionsTableSeeder.php

示例7: array

$oldActionNames = array();
foreach ($oldActions as $oldAction) {
    $name = $oldAction->get('name');
    if (!in_array($name, $actions)) {
        $oldAction->delete();
        echo "Deleting {$name}<br />\n";
    } else {
        $oldActionNames[] = $name;
    }
}
foreach ($actions as $action) {
    if (!in_array($action, $oldActionNames)) {
        echo "Adding {$action}<br />\n";
        $new = new Action();
        $new->set('name', $action);
        $new->save();
    }
}
$actions = Action::searchForAll();
$statuses = Status::searchForAll();
$rights = Right::SearchForAll();
$listRights = array();
foreach ($actions as $action) {
    foreach ($statuses as $status) {
        $listRights[] = $action->get('id') . '.' . $status->get('id');
    }
}
$oldrights = array();
foreach ($rights as $right) {
    $actionId = $right->get('actionId');
    $statusId = $right->get('statusId');
开发者ID:Babaritech,项目名称:babar2,代码行数:31,代码来源:_update_new_actions_rights.php

示例8: Action

<?php

$actionID = $this->id();
Command::captureUrl();
if (TasksappValidator::checkInteger($actionID)) {
    $db = Database::getInstance();
    $inputArray = $db->getActionByActionID($actionID);
    $action = $inputArray[0];
} else {
    $action = new Action($_POST);
    if ($action->verifyActionData()) {
        $action->save();
        header("Location: " . Command::retrieveUrl());
        exit;
    }
}
$projectsArray = Command::getProjectList($action->client_id());
include_once '../views/showEditActionForm.php';
开发者ID:nigeldgreen,项目名称:tasksapp,代码行数:18,代码来源:edit_action.php

示例9: postUpdate

 public function postUpdate($group_id)
 {
     Allow::permission($this->module['group'], 'groups');
     $json_request = array('status' => FALSE, 'responseText' => '', 'responseErrorText' => '', 'redirect' => FALSE);
     if (!Request::ajax()) {
         App::abort(404);
     }
     if (!($group = Group::find($group_id))) {
         $json_request['responseText'] = 'Запрашиваемая группа не найдена!';
         return Response::json($json_request, 400);
     }
     $validation = Validator::make(Input::all(), Group::$rules_update);
     if ($validation->passes()) {
         ## Update group
         $group->name = mb_strtolower(Input::get('name'));
         $group->desc = Input::get('desc');
         $group->dashboard = Input::get('dashboard');
         $group->start_url = Input::get('start_url');
         $group->save();
         $group->touch();
         ## Update actions
         Action::where('group_id', $group_id)->delete();
         if (is_array(Input::get('actions')) && count(Input::get('actions'))) {
             foreach (Input::get('actions') as $module_name => $actions) {
                 foreach ($actions as $a => $act) {
                     $action = new Action();
                     $action->group_id = $group_id;
                     $action->module = $module_name;
                     $action->action = $act;
                     $action->status = 1;
                     $action->save();
                 }
             }
         }
         $json_request['responseText'] = 'Группа обновлена';
         #$json_request['responseText'] = print_r($group_id, 1);
         #$json_request['responseText'] = print_r($group, 1);
         #$json_request['responseText'] = print_r(Input::get('actions'), 1);
         #$json_request['responseText'] = print_r($group->actions(), 1);
         #$json_request['redirect'] = link::auth('groups');
         $json_request['status'] = TRUE;
     } else {
         $json_request['responseText'] = 'Неверно заполнены поля';
         $json_request['responseErrorText'] = implode($validation->messages()->all(), '<br />');
     }
     return Response::json($json_request, 200);
 }
开发者ID:Grapheme,项目名称:doktornarabote,代码行数:47,代码来源:admin_groups.controller.php

示例10: addSample

 public function addSample($songID)
 {
     $song = Song::find($songID);
     if ($song == null) {
         return Redirect::route('albums-home')->with('fail', "That song doesn't exist.");
     }
     if (Input::get('sample-artist') == '') {
         return Redirect::route('albums-home')->with('fail', "Please enter Artist Name.");
     }
     if (Input::get('sample-title') == '') {
         return Redirect::route('albums-home')->with('fail', "Please enter Song Title.");
     }
     $sample = new Sample();
     $sample->song_id = $songID;
     $sample->sample_artist = Input::get('sample-artist');
     $sample->sample_title = Input::get('sample-title');
     $sample->author_id = Auth::user()->id;
     $action = new Action();
     $action->song_title = $song->title;
     $action->action = "Added sample";
     $action->user_id = Auth::user()->id;
     if ($sample->save() && $action->save()) {
         return Redirect::route('albums-home')->with('success', 'The sample was added.');
     } else {
         return Redirect::route('albums-home')->with('fail', 'An error occured while saving the sample.');
     }
 }
开发者ID:kylehagler,项目名称:CHP,代码行数:27,代码来源:AlbumsController.php

示例11: actionEdit

 public function actionEdit()
 {
     //echo "<pre>";var_dump($_REQUEST);exit;
     $action = new Action();
     $actionInfo = array();
     $label = '';
     foreach ($_REQUEST as $k => $v) {
         $_REQUEST[$k] = trim($v);
     }
     $menutype = isset($_REQUEST['menu_type']) ? intval($_REQUEST['menu_type']) : '0';
     $whichFirstMenu = isset($_REQUEST['firstmenu']) ? intval($_REQUEST['firstmenu']) : '-1';
     $menusort = isset($_REQUEST['menusort']) ? intval($_REQUEST['menusort']) : 0;
     $firstmenus = Action::model()->findAll('is_menu=1');
     if (isset($_REQUEST['id']) && $_REQUEST['id'] != '') {
         // 修改
         $actionInfo = $action->find('aid=:id', array(':id' => $_REQUEST['id']));
         if (!empty($_REQUEST['modify'])) {
             $action->updateByPk($_REQUEST['id'], array('aname' => $_REQUEST['name'], 'route' => $_REQUEST['route'], 'is_menu' => $menutype, 'menusort' => $menusort, 'first_menu' => $whichFirstMenu));
             $this->redirect('/main/action/list');
         }
     } elseif (!empty($_REQUEST['name'])) {
         // 新增
         $actionInfo = $action->find('aname=:name or route=:route', array(':name' => $_REQUEST['name'], ':route' => $_REQUEST['route']));
         if (!empty($actionInfo)) {
             $this->render('edit', array('firstmenus' => $firstmenus, 'entity' => $actionInfo, 'label' => 'has_action'));
             exit;
         }
         if (!empty($_REQUEST['modify'])) {
             $action->aname = $_REQUEST['name'];
             $action->route = $_REQUEST['route'];
             $action->is_menu = $menutype;
             $action->first_menu = $whichFirstMenu;
             $action->menusort = $menusort;
             $action->save();
             $this->redirect('/main/action/list');
         }
         //echo "<pre>";var_dump($_REQUEST,$actionInfo);exit;
     }
     $this->render('edit', array('firstmenus' => $firstmenus, 'entity' => $actionInfo, 'label' => $label));
 }
开发者ID:jinchunguang,项目名称:backadmin_yii,代码行数:40,代码来源:ActionController.php

示例12: Resolution

// Clear out the lookup tables.  We'll import everything from Mongo
// The mysql.sql script preloads some generic values for these tables
$zend_db->delete('resolutions');
$zend_db->delete('actions');
$result = $mongo->resolutions->find();
foreach ($result as $r) {
    $o = new Resolution();
    $o->handleUpdate($r);
    $o->save();
    echo "Resolution: {$o->getName()}\n";
}
$result = $mongo->actions->find();
foreach ($result as $r) {
    $o = new Action();
    $o->handleUpdate($r);
    $o->save();
    echo "Action: {$o->getName()}\n";
}
$result = $mongo->lookups->findOne(array('name' => 'contactMethods'));
$methods = $result['items'];
foreach ($methods as $m) {
    $o = new ContactMethod();
    $o->setName($m);
    $o->save();
    echo "ContactMethod: {$o->getName()}\n";
}
$result = $mongo->lookups->findOne(array('name' => 'types'));
$types = $result['items'];
foreach ($types as $t) {
    $o = new IssueType();
    $o->setName($t);
开发者ID:CodeForEindhoven,项目名称:uReport,代码行数:31,代码来源:1_lookups.php

示例13: saveAction

 /**
  * [saveAction description]
  * @return [type] [description]
  */
 public function saveAction()
 {
     Input::flash();
     $data = Input::all();
     $rules = array('actionname' => array('min:3', 'required'));
     // Build the custom messages array.
     $messages = array('action.min' => 'กรุณาระบุชื่อการกระทำอย่างน้อย :min ตัวอักษร.', 'action.required' => 'กรุณาระบุชื่อการกระทำ');
     $action_content = trim($data['actionname']);
     // Create a new validator instance.
     $validator = Validator::make($data, $rules, $messages);
     if ($validator->passes()) {
         $action = new Action();
         $chk_action = $action->checkAction($action_content);
         if ($chk_action) {
             $action->action_name = $action_content;
             $action->save();
             return Redirect::route('actionshow')->with('success', 'บันทึกสำเร็จ');
         } else {
             return Redirect::route('actionadd')->with('warning', 'มีชื่อการกระทำในระบบแล้ว');
         }
     } else {
         // $errors = $validator->messages();
         return Redirect::route('actionadd')->withErrors($validator);
     }
 }
开发者ID:nattaphat,项目名称:cuse2,代码行数:29,代码来源:ActionController.php


注:本文中的Action::save方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。