本文整理汇总了PHP中Notifier::notifyAction方法的典型用法代码示例。如果您正苦于以下问题:PHP Notifier::notifyAction方法的具体用法?PHP Notifier::notifyAction怎么用?PHP Notifier::notifyAction使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Notifier
的用法示例。
在下文中一共展示了Notifier::notifyAction方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: createLog
/**
* Create new log entry and return it
*
* Delete actions are automatically marked as silent if $is_silent value is not provided (not NULL)
*
* @param ApplicationDataObject $object
* @param Project $project
* @param DataManager $manager
* @param boolean $save Save log object before you save it
* @return ApplicationReadLog
*/
static function createLog(ApplicationDataObject $object, $workspaces, $action = null, $save = true, $log_data = '')
{
if (is_null($action)) {
$action = self::ACTION_READ;
}
// if
if (!self::isValidAction($action)) {
throw new Error("'{$action}' is not valid log action");
}
// if
try {
Notifier::notifyAction($object, $action, $log_data);
} catch (Exception $ex) {
}
$manager = $object->manager();
if (!$manager instanceof DataManager) {
throw new Error('Invalid object manager');
}
// if
$log = new ApplicationReadLog();
if (logged_user() instanceof Contact) {
$log->setTakenById(logged_user()->getId());
} else {
$log->setTakenById(0);
}
$log->setRelObjectId($object->getObjectId());
$log->setAction($action);
if ($save) {
$log->save();
}
// if
return $log;
}
示例2: createLog
/**
* Create new log entry and return it
*
* Delete actions are automatically marked as silent if $is_silent value is not provided (not NULL)
*
* @param ApplicationDataObject $object
* @param Project $project
* @param DataManager $manager
* @param boolean $save Save log object before you save it
* @return ApplicationLog
*/
static function createLog($object, $action = null, $is_private = false, $is_silent = null, $save = true, $log_data = '')
{
$args = array('action' => &$action, 'is_private' => &$is_private, 'is_silent' => &$is_silent, 'save' => &$save, 'log_data' => &$log_data);
/**
* Modify log and notification parameters before creating the application log registry
*/
Hook::fire('application_logs_create', $object, $args);
if (is_null($action)) {
$action = self::ACTION_ADD;
}
// if
if (!self::isValidAction($action)) {
throw new Error("'{$action}' is not valid log action");
}
// if
if ($object instanceof TemplateTask || $object instanceof TemplateMilestone) {
$is_silent = true;
}
if (is_null($is_silent)) {
$is_silent = $action == self::ACTION_DELETE;
} else {
$is_silent = (bool) $is_silent;
}
// if
if (!$is_silent) {
try {
Notifier::notifyAction($object, $action, $log_data);
} catch (Exception $ex) {
Logger::log($ex->getMessage());
}
}
$log = new ApplicationLog();
if (logged_user() instanceof Contact) {
$log->setTakenById(logged_user()->getId());
} else {
$log->setTakenById(0);
}
if ($object instanceof ContentDataObject) {
$log->setRelObjectId($object->getObjectId());
$log->setObjectName($object->getObjectName());
}
if ($object instanceof Member) {
$log->setMemberId($object->getId());
$log->setRelObjectId($object->getObjectId());
$log->setObjectName($object->getName());
}
$log->setAction($action);
$log->setIsPrivate($is_private);
$log->setIsSilent($is_silent);
$log->setLogData($log_data);
if ($save) {
$log->save();
}
// if
return $log;
}
示例3: createLog
/**
* Create new log entry and return it
*
* Delete actions are automatically marked as silent if $is_silent value is not provided (not NULL)
*
* @param ApplicationDataObject $object
* @param Project $project
* @param DataManager $manager
* @param boolean $save Save log object before you save it
* @return ApplicationReadLog
*/
static function createLog(ApplicationDataObject $object, $workspaces, $action = null, $is_private = false, $is_silent = null, $save = true, $log_data = '')
{
if (is_null($action)) {
$action = self::ACTION_READ;
}
// if
if (!self::isValidAction($action)) {
throw new Error("'{$action}' is not valid log action");
}
// if
try {
Notifier::notifyAction($object, $action, $log_data);
} catch (Exception $ex) {
}
$manager = $object->manager();
if (!$manager instanceof DataManager) {
throw new Error('Invalid object manager');
}
// if
$log = new ApplicationReadLog();
if (logged_user() instanceof User) {
$log->setTakenById(logged_user()->getId());
} else {
$log->setTakenById(0);
}
$log->setRelObjectId($object->getObjectId());
$log->setRelObjectManager(get_class($manager));
$log->setAction($action);
if ($save) {
$log->save();
}
// if
if ($save) {
if ($workspaces instanceof Project) {
$wo = new WorkspaceObject();
$wo->setObject($log);
$wo->setWorkspace($workspaces);
$wo->save();
} else {
if (is_array($workspaces)) {
foreach ($workspaces as $w) {
if ($w instanceof Project) {
$wo = new WorkspaceObject();
$wo->setObject($log);
$wo->setWorkspace($w);
$wo->save();
}
}
}
}
}
return $log;
}
示例4: createLog
/**
* Create new log entry and return it
*
* Delete actions are automatically marked as silent if $is_silent value is not provided (not NULL)
*
* @param ApplicationDataObject $object
* @param Project $project
* @param DataManager $manager
* @param boolean $save Save log object before you save it
* @return ApplicationLog
*/
static function createLog($object, $action = null, $is_private = false, $is_silent = null, $save = true, $log_data = '') {
if(is_null($action)) {
$action = self::ACTION_ADD;
} // if
if(!self::isValidAction($action)) {
throw new Error("'$action' is not valid log action");
} // if
if(is_null($is_silent)) {
$is_silent = $action == self::ACTION_DELETE;
} else {
$is_silent = (boolean) $is_silent;
} // if
if (!$is_silent) {
try {
Notifier::notifyAction($object, $action, $log_data);
} catch (Exception $ex) {
Logger::log($ex->getMessage());
}
}
$log = new ApplicationLog();
if (logged_user() instanceof Contact) {
$log->setTakenById(logged_user()->getId());
} else {
$log->setTakenById(0);
}
if ($object instanceof ContentDataObject) {
$log->setRelObjectId($object->getObjectId());
$log->setObjectName($object->getObjectName());
}
if ($object instanceof Member) {
$log->setRelObjectId($object->getId());
$log->setObjectName($object->getName());
}
$log->setAction($action);
$log->setIsPrivate($is_private);
$log->setIsSilent($is_silent);
$log->setLogData($log_data);
if($save) {
$log->save();
} // if
return $log;
} // createLog
示例5: createLog
/**
* Create new log entry and return it
*
* Delete actions are automatically marked as silent if $is_silent value is not provided (not NULL)
*
* @param ApplicationDataObject $object
* @param Project $project
* @param DataManager $manager
* @param boolean $save Save log object before you save it
* @return ApplicationLog
*/
static function createLog(ApplicationDataObject $object, $workspaces, $action = null, $is_private = false, $is_silent = null, $save = true, $log_data = '')
{
if (is_null($action)) {
$action = self::ACTION_ADD;
}
// if
if (!self::isValidAction($action)) {
throw new Error("'{$action}' is not valid log action");
}
// if
if (is_null($is_silent)) {
$is_silent = $action == self::ACTION_DELETE;
} else {
$is_silent = (bool) $is_silent;
}
// if
if (!$is_silent) {
try {
Notifier::notifyAction($object, $action, $log_data);
} catch (Exception $ex) {
}
}
if ($object != null) {
$manager = $object->manager();
}
if (!$manager instanceof DataManager) {
throw new Error('Invalid object manager');
}
// if
$log = new ApplicationLog();
if (logged_user() instanceof User) {
$log->setTakenById(logged_user()->getId());
} else {
$log->setTakenById(0);
}
$log->setRelObjectId($object->getObjectId());
$log->setObjectName($object->getObjectName());
$log->setRelObjectManager(get_class($manager));
$log->setAction($action);
$log->setIsPrivate($is_private);
$log->setIsSilent($is_silent);
$log->setLogData($log_data);
if ($save) {
$log->save();
}
// if
// Update is private for this object
/*if($object instanceof ProjectDataObject) {
ApplicationLogs::setIsPrivateForObject($object);
} // if*/
if ($save) {
if ($workspaces instanceof Project) {
$wo = new WorkspaceObject();
$wo->setObject($log);
$wo->setWorkspace($workspaces);
$wo->save();
} else {
if (is_array($workspaces)) {
foreach ($workspaces as $w) {
if ($w instanceof Project) {
$wo = new WorkspaceObject();
$wo->setObject($log);
$wo->setWorkspace($w);
$wo->save();
}
}
}
}
}
return $log;
}