本文整理汇总了PHP中Actions类的典型用法代码示例。如果您正苦于以下问题:PHP Actions类的具体用法?PHP Actions怎么用?PHP Actions使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Actions类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: sendit_subscription
function sendit_subscription()
{
$sendit = new Actions();
$sendit->NewSubscriber();
wp_die();
// this is required to terminate immediately and return a proper response
}
示例2: TriggerDisplayPage
public static function TriggerDisplayPage(array $param)
{
$action = new Actions();
if ($action->DisplayPage($param[0])) {
exit;
}
}
示例3: testMergeActions
public function testMergeActions()
{
$contact = $this->contact('testAnyone');
$action = new Actions();
$action->actionDescription = "TEST";
$action->visibility = 1;
$action->associationType = "contacts";
$action->associationId = $contact->id;
$action->save();
$model = new Contacts();
foreach ($contact->attributes as $key => $val) {
if ($key != 'id' && $key != 'nameId') {
$model->{$key} = $val;
}
}
$model->save();
$this->assertEquals(0, Yii::app()->db->createCommand()->select('COUNT(*)')->from('x2_actions')->where('associationType = "contacts" AND associationId = :id', array(':id' => $model->id))->queryScalar());
$this->assertEquals(1, Yii::app()->db->createCommand()->select('COUNT(*)')->from('x2_actions')->where('associationType = "contacts" AND associationId = :id', array(':id' => $contact->id))->queryScalar());
$mergeData = $model->mergeActions($contact, true);
$this->assertEquals(1, Yii::app()->db->createCommand()->select('COUNT(*)')->from('x2_actions')->where('associationType = "contacts" AND associationId = :id', array(':id' => $model->id))->queryScalar());
$this->assertEquals(0, Yii::app()->db->createCommand()->select('COUNT(*)')->from('x2_actions')->where('associationType = "contacts" AND associationId = :id', array(':id' => $contact->id))->queryScalar());
$model->unmergeActions($contact->id, $mergeData);
$this->assertEquals(1, Yii::app()->db->createCommand()->select('COUNT(*)')->from('x2_actions')->where('associationType = "contacts" AND associationId = :id', array(':id' => $contact->id))->queryScalar());
$this->assertEquals(0, Yii::app()->db->createCommand()->select('COUNT(*)')->from('x2_actions')->where('associationType = "contacts" AND associationId = :id', array(':id' => $model->id))->queryScalar());
}
示例4: execute
public function execute(&$params)
{
$model = new Actions();
$model->type = 'note';
$model->complete = 'Yes';
$model->associationId = $params['model']->id;
$model->associationType = $params['model']->module;
$model->actionDescription = $this->parseOption('comment', $params);
$model->assignedTo = $this->parseOption('assignedTo', $params);
$model->completedBy = $this->parseOption('assignedTo', $params);
if (empty($model->assignedTo) && $params['model']->hasAttribute('assignedTo')) {
$model->assignedTo = $params['model']->assignedTo;
$model->completedBy = $params['model']->assignedTo;
}
if ($params['model']->hasAttribute('visibility')) {
$model->visibility = $params['model']->visibility;
}
$model->createDate = time();
$model->completeDate = time();
if ($model->save()) {
return array(true, Yii::t('studio', 'View created action: ') . $model->getLink());
} else {
$errors = $model->getErrors();
return array(false, array_shift($errors));
}
}
示例5: renderInput
public function renderInput(CModel $model, $attribute, array $htmlOptions = array())
{
$action = new Actions();
$action->setAttributes($model->getAttributes(), false);
$defaultOptions = array('id' => $this->resolveId($attribute));
$htmlOptions = X2Html::mergeHtmlOptions($defaultOptions, $htmlOptions);
return preg_replace('/Actions(\\[[^\\]]*\\])/', get_class($this->formModel) . '$1', $action->renderInput($attribute, $htmlOptions));
}
示例6: delete
public function delete($id)
{
$db = new Db($this->subgridConfig, $this->statusVariables);
$fields = $this->subgridConfig->fields();
$curData = $db->fetchRow($id);
foreach ($fields as $field) {
$fieldObject = $this->subgridConfig->fieldObject($field);
$fieldObject->beforeDelete($id, $curData);
}
$sql = "\n DELETE\n " . $this->subgridConfig->tableName() . "\n FROM\n " . $this->subgridConfig->tableName() . "\n " . $db->joinQuery() . "\n WHERE\n " . $this->subgridConfig->tableName() . ".`" . $this->subgridConfig->idField() . "` = :id\n ";
$params = array('id' => $id);
$callables = $this->subgridConfig->beforeDelete();
if ($callables) {
if (is_array($callables) && !is_callable($callables)) {
foreach ($callables as $callable) {
call_user_func($callable, $params['id']);
}
} else {
call_user_func($callables, $params['id']);
}
}
ipDb()->execute($sql, $params);
if ($this->subgridConfig->isMultilingual()) {
$sql = "\n DELETE\n\n FROM\n " . $this->subgridConfig->languageTableName() . "\n WHERE\n " . $this->subgridConfig->languageTableName() . ".`" . $this->subgridConfig->languageForeignKeyField() . "` = :id\n ";
ipDb()->execute($sql, $params);
}
$callables = $this->subgridConfig->afterDelete();
if ($callables) {
if (is_array($callables) && !is_callable($callables)) {
foreach ($callables as $callable) {
call_user_func($callable, $params['id']);
}
} else {
call_user_func($callables, $params['id']);
}
}
//remove records in child grids
foreach ($fields as $field) {
$fieldObject = $this->subgridConfig->fieldObject($field);
$fieldObject->afterDelete($id, $curData);
if ($field['type'] == 'Grid') {
$childStatusVariables = Status::genSubgridVariables($this->statusVariables, $field['gridId'], $id);
$subActions = new Actions(new Config($field['config']), $childStatusVariables);
$childConfig = new Config($field['config']);
$db = new Db($childConfig, $childStatusVariables);
$where = $db->buildSqlWhere();
$sql = "\n SELECT\n `" . $childConfig->idField() . "`\n FROM\n " . $childConfig->tableName() . "\n WHERE\n {$where}\n ";
$idsToDelete = ipDb()->fetchColumn($sql);
foreach ($idsToDelete as $idToDelete) {
$subActions->delete($idToDelete);
}
}
}
}
示例7: form
/**
* @param array $instance
* @return string|void
* @description Widget Backend
*/
public function form($instance)
{
if (isset($instance['title'])) {
$title = $instance['title'];
}
$post_types = get_post_types();
$objAction = new Actions();
$data['post_types'] = $post_types;
$data['title'] = $title;
$data['obj'] = $this;
$data['post_type'] = get_post_types();
echo $objAction->theme('nv_new_posts_widget', $data);
}
示例8: testRunAddUser
/**
* Makes sure adding a user happens without errors
*
* @link http://issues.thebuggenie.com/thebuggenie/issues/2494
*
* @covers thebuggenie\core\modules\configuration\Actions::runAddUser
* @dataProvider addUserRequestProvider
*/
public function testRunAddUser($username, $buddyname, $email, $password, $group_id)
{
\b2db\Core::resetMocks();
$scope = $this->getMockBuilder('thebuggenie\\core\\entities\\Scope')->setMethods(array('hasUsersAvailable'))->getMock();
$scope->method('hasUsersAvailable')->willReturn(true);
\thebuggenie\core\framework\Context::setScope($scope);
$request = new \thebuggenie\core\framework\Request();
$request->setParameter('username', $username);
$request->setParameter('buddyname', $buddyname);
$request->setParameter('email', $email);
$request->setParameter('password', $password);
$request->setParameter('password_repeat', $password);
$request->setParameter('group_id', $group_id);
$usertablestub = $this->getMockBuilder('b2db\\Table')->setMethods(array('isUsernameAvailable'))->getMock();
$userscopestablestub = $this->getMockBuilder('b2db\\Table')->getMock();
\b2db\Core::setTableMock('thebuggenie\\core\\entities\\tables\\UserScopes', $userscopestablestub);
\b2db\Core::setTableMock('thebuggenie\\core\\entities\\User', $usertablestub);
\b2db\Core::setTableMock('thebuggenie\\core\\entities\\tables\\Users', $usertablestub);
$usertablestub->method('isUsernameAvailable')->will($this->returnValue(true));
// Expect action to verify that username is available
$usertablestub->expects($this->once())->method('isUsernameAvailable')->with($username);
$userscopestablestub->expects($this->once())->method('countUsers');
$this->object->runAddUser($request);
$userobject = \b2db\Core::getTable('thebuggenie\\core\\entities\\tables\\Users')->getLastMockObject();
// Expect action to set correct user properties
$this->assertEquals($userobject->getUsername(), $username);
$this->assertEquals($userobject->getBuddyname(), $buddyname);
$this->assertEquals($userobject->getRealname(), $username);
$this->assertEquals($userobject->getEmail(), $email);
}
示例9: addNormalUser
private function addNormalUser($aRequest)
{
$aUser = array();
foreach ($this->aUserParams as $sParam) {
switch ($sParam) {
case "username":
$aUser[$sParam] = strtolower($aRequest[$sParam]);
break;
case "logo":
$aUser[$sParam] = Actions::uploadPhotos($aRequest['logo'], 'logo');
break;
default:
$aUser[$sParam] = $aRequest[$sParam];
break;
}
}
$aUser['date_registered'] = date('Y-m-d h:i:s');
$aUser['age'] = $aRequest['date_of_birth'];
//Hashing the password to be saved encrypted
$aUser['password'] = Hash::make($aUser['password']);
DB::table('users')->insert($aUser);
$dIdUser = DB::table('users')->where(array('username' => $aUser['username']))->get(array('id_user'));
DB::table('user_rating')->insert(array('id_user' => $dIdUser[0]->id_user, 'likes_count' => 0));
echo "You've registered successfully!";
return redirect()->intended('/');
}
示例10: execute
public function execute(array $gvSelection)
{
$updatedRecordsNum = Actions::changeCompleteState('uncomplete', $gvSelection);
if ($updatedRecordsNum > 0) {
self::$successFlashes[] = Yii::t('app', '{updatedRecordsNum} action' . ($updatedRecordsNum === 1 ? '' : 's') . ' uncompleted', array('{updatedRecordsNum}' => $updatedRecordsNum));
}
return $updatedRecordsNum;
}
示例11: processRequest
/**
* Processes the specified route
* @exits
* @return null
*/
public function processRequest()
{
Actions::trigger("{$this->routeKey}AjaxStart");
$response = call_user_func($this->action);
Actions::trigger("{$this->routeKey}AjaxEnd");
echo json_encode($response);
die;
}
示例12: renderAttribute
public function renderAttribute($attr, $makeLinks = true, $textOnly = true, $encode = true)
{
if ($attr === 'text') {
$action = Actions::model();
$action->actionDescription = $this->{$attr};
return $action->renderAttribute('actionDescription', $makeLinks, $textOnly, $encode);
}
}
示例13: execute
public function execute(&$params)
{
$options = $this->config['options'];
$action = new Actions();
$action->subject = $this->parseOption('subject', $params);
$action->dueDate = $this->parseOption('dueDate', $params);
$action->actionDescription = $this->parseOption('description', $params);
$action->priority = $this->parseOption('priority', $params);
$action->visibility = $this->parseOption('visibility', $params);
if (isset($params['model'])) {
$action->assignedTo = $this->parseOption('assignedTo', $params);
}
// if(isset($this->config['attributes']))
// $this->setModelAttributes($action,$this->config['attributes'],$params);
if ($action->save()) {
return array(true, Yii::t('studio', "View created action: ") . $action->getLink());
} else {
$errors = $action->getErrors();
return array(false, array_shift($errors));
}
// if($this->parseOption('reminder',$params)) {
// $notif=new Notification;
// $notif->modelType='Actions';
// $notif->createdBy=Yii::app()->user->getName();
// $notif->modelId=$model->id;
// if($_POST['notificationUsers']=='me'){
// $notif->user=Yii::app()->user->getName();
// }else{
// $notif->user=$model->assignedTo;
// }
// $notif->createDate=$model->dueDate-($_POST['notificationTime']*60);
// $notif->type='action_reminder';
// $notif->save();
// if($_POST['notificationUsers']=='both' && Yii::app()->user->getName()!=$model->assignedTo){
// $notif2=new Notification;
// $notif2->modelType='Actions';
// $notif2->createdBy=Yii::app()->user->getName();
// $notif2->modelId=$model->id;
// $notif2->user=Yii::app()->user->getName();
// $notif2->createDate=$model->dueDate-($_POST['notificationTime']*60);
// $notif2->type='action_reminder';
// $notif2->save();
// }
// }
}
示例14: run
/**
* Creates the widget.
*/
public function run()
{
list($assignedToCondition, $params) = Actions::model()->getAssignedToCondition();
$total = Yii::app()->db->createCommand("\n select count(*)\n from x2_actions\n where {$assignedToCondition} and (type='' or type is null)\n ")->queryScalar($params);
$incomplete = Yii::app()->db->createCommand("\n select count(*)\n from x2_actions\n where {$assignedToCondition} and (type='' or type is null) and complete='No'\n ")->queryScalar($params);
$overdue = Actions::model()->countByAttributes(array('assignedTo' => Yii::app()->user->getName(), 'complete' => 'No'), 'dueDate < ' . time() . ' AND (type="" OR type IS NULL)');
$complete = Actions::model()->countByAttributes(array('completedBy' => Yii::app()->user->getName(), 'complete' => 'Yes'), 'type="" OR type IS NULL');
$this->render('actionMenu', array('total' => $total, 'unfinished' => $incomplete, 'overdue' => $overdue, 'complete' => $complete));
}
示例15: __construct
/**
* @return void
*/
protected function __construct()
{
$this->oHttp = \MailSo\Base\Http::NewInstance();
$this->oActions = Actions::NewInstance();
$this->oActions->SetHttp($this->oHttp);
$this->oTwilio = $this->oActions->GetTwilio();
\CApi::Plugin()->SetActions($this->oActions);
// \MailSo\Config::$FixIconvByMbstring = false;
\MailSo\Config::$SystemLogger = \CApi::MailSoLogger();
}