本文整理汇总了PHP中Observer类的典型用法代码示例。如果您正苦于以下问题:PHP Observer类的具体用法?PHP Observer怎么用?PHP Observer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Observer类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: detach
/**
* @param Observer $observer
* @see Subject::detach()
*/
public function detach(Observer $observer)
{
$hash = $observer->hashCode();
if (isset($this->observers[$hash])) {
unset($this->observers[$hash]);
}
}
示例2: testBindByObject
public function testBindByObject()
{
$stdMock = $this->getMock('\\StdClass', ['test']);
$stdMock->expects($this->once())->method('test');
$callback = function () use($stdMock) {
$stdMock->test();
};
$obj = new \StdClass();
$observer = new Observer([[$obj, 'test', $callback]]);
$observer->trigger($obj, 'test');
}
示例3: dispatch
/**
* Dispatch event
*
* Calls all observer callbacks registered for this event
* and multiple observers matching event name pattern
*
* @param string $eventName
* @param array $data
* @return void
*/
public function dispatch($eventName, array $data = array())
{
\Magento\Framework\Profiler::start('EVENT:' . $eventName, array('group' => 'EVENT', 'name' => $eventName));
foreach ($this->_eventConfig->getObservers($eventName) as $observerConfig) {
$event = new \Magento\Framework\Event($data);
$event->setName($eventName);
$wrapper = new Observer();
$wrapper->setData(array_merge(array('event' => $event), $data));
\Magento\Framework\Profiler::start('OBSERVER:' . $observerConfig['name']);
$this->_invoker->dispatch($observerConfig, $wrapper);
\Magento\Framework\Profiler::stop('OBSERVER:' . $observerConfig['name']);
}
\Magento\Framework\Profiler::stop('EVENT:' . $eventName);
}
示例4: detach
/**
* Remove um observador do objeto
* @param Observer $observer
* @return boolean TRUE caso o observador tenha sido
* removido com sucesso
* @see Subject::detach()
*/
public function detach( Observer $observer ) {
if ( $observer instanceof Object ) {
$hashCode = $observer->hashCode();
} else {
$hashCode = spl_object_hash( $observer );
}
if ( isset( $this->observers[ $hashCode ] ) ) {
unset( $this->observers[ $hashCode ] );
return true;
}
return false;
}
示例5: before
public function before()
{
$page = strtolower(substr(get_class($this), 11));
Model_Navigation::init(Kohana::$config->load('sitemap')->as_array());
parent::before();
$navigation = Model_Navigation::get();
$this->page = Model_Navigation::$current;
if ($this->auto_render !== TRUE) {
return;
}
$this->template->set_global(array('page_body_id' => $this->get_path(), 'page_name' => $page, 'page' => $this->page));
if ($this->request->is_iframe()) {
$navigation = NULL;
$this->template->footer = NULL;
$this->template->breadcrumbs = NULL;
Config::set('site', 'profiling', 'no');
$this->query_params = array('type' => 'iframe');
} else {
$this->template->breadcrumbs = Config::get('site', 'breadcrumbs') == Config::YES ? $this->breadcrumbs : NULL;
$this->template->footer = View::factory('system/blocks/footer');
}
$this->template->theme = 'theme-' . Model_User_Meta::get('admin_theme', Config::get('global', 'default_theme'));
$this->template->bind_global('navigation', $navigation);
Observer::notify('controller_before_' . $this->get_path());
}
示例6: browse
public function browse()
{
$this->_checkPermission();
$params = func_get_args();
$this->path = join('/', $params);
// make sure there's a / at the end
if (substr($this->path, -1, 1) != '/') {
$this->path .= '/';
}
//security
// we dont allow back link
if (strpos($this->path, '..') !== false) {
if (Plugin::isEnabled('statistics_api')) {
$user = null;
if (AuthUser::isLoggedIn()) {
$user = AuthUser::getUserName();
}
$ip = isset($_SERVER['HTTP_X_FORWARDED_FOR']) ? $_SERVER['HTTP_X_FORWARDED_FOR'] : $_SERVER['REMOTE_ADDR'];
$event = array('event_type' => 'hack_attempt', 'description' => __('A possible hack attempt was detected.'), 'ipaddress' => $ip, 'username' => $user);
Observer::notify('stats_file_manager_hack_attempt', $event);
}
}
$this->fullpath = FILES_DIR . '/sidebarlink/images/';
// clean up nicely
$this->fullpath = preg_replace('/\\/\\//', '/', $this->fullpath);
$this->display('sidebarlink/index', array('dir' => $this->path, 'files' => $this->_getListFiles(), 'sidebarlinks' => Record::findAllFrom('SidebarLink', '1=1 ORDER BY id desc'), 'pages' => Record::findAllFrom('Page', 'parent_id=1 OR parent_id=0 order by parent_id,position')));
}
示例7: comment_save
function comment_save(&$page)
{
// check if we need to save a comment
if (!isset($_POST['comment'])) {
return;
}
global $__FROG_CONN__;
if ($page->comment_status != Comment::OPEN) {
return;
}
$data = $_POST['comment'];
if (is_null($data)) {
return;
}
if (!isset($data['author_name']) or trim($data['author_name']) == '') {
return;
}
if (!isset($data['author_email']) or trim($data['author_email']) == '') {
return;
}
if (!isset($data['body']) or trim($data['body']) == '') {
return;
}
use_helper('Kses');
$allowed_tags = array('a' => array('href' => array(), 'title' => array()), 'abbr' => array('title' => array()), 'acronym' => array('title' => array()), 'b' => array(), 'blockquote' => array('cite' => array()), 'br' => array(), 'code' => array(), 'em' => array(), 'i' => array(), 'p' => array(), 'strike' => array(), 'strong' => array());
// get the setting for comments moderations
//$sql = 'SELECT value FROM '.TABLE_PREFIX.'setting WHERE name=\'auto_approve_comment\'';
//$stmt = $__FROG_CONN__->prepare($sql);
//$stmt->execute();
//$auto_approve_comment = (int) $stmt->fetchColumn();
$auto_approve_comment = 1;
$sql = 'INSERT INTO ' . TABLE_PREFIX . 'comment (page_id, author_name, author_email, author_link, body, is_approved, created_on) VALUES (' . '\'' . $page->id . '\', ' . $__FROG_CONN__->quote(strip_tags($data['author_name'])) . ', ' . $__FROG_CONN__->quote(strip_tags($data['author_email'])) . ', ' . $__FROG_CONN__->quote(strip_tags($data['author_link'])) . ', ' . $__FROG_CONN__->quote(kses($data['body'], $allowed_tags)) . ', ' . $__FROG_CONN__->quote($auto_approve_comment) . ', ' . $__FROG_CONN__->quote(date('Y-m-d H:i:s')) . ')';
$__FROG_CONN__->exec($sql);
Observer::notify('comment_after_add');
}
示例8: on_page_load
public function on_page_load()
{
$email_ctx_id = $this->get('email_id_ctx', 'email');
$email = $this->_ctx->get($email_ctx_id);
$referrer_page = Request::current()->referrer();
$next_page = $this->get('next_url', Request::current()->referrer());
if (!Valid::email($email)) {
Messages::errors(__('Use a valid e-mail address.'));
HTTP::redirect($referrer_page);
}
$user = ORM::factory('user', array('email' => $email));
if (!$user->loaded()) {
Messages::errors(__('No user found!'));
HTTP::redirect($referrer_page);
}
$reflink = ORM::factory('user_reflink')->generate($user, 'forgot', array('next_url' => URL::site($this->next_url, TRUE)));
if (!$reflink) {
Messages::errors(__('Reflink generate error'));
HTTP::redirect($referrer_page);
}
Observer::notify('admin_login_forgot_before', $user);
try {
Email_Type::get('user_request_password')->send(array('username' => $user->username, 'email' => $user->email, 'reflink' => Route::url('reflink', array('code' => $reflink)), 'code' => $reflink));
Messages::success(__('Email with reflink send to address set in your profile'));
} catch (Exception $e) {
Messages::error(__('Something went wrong'));
}
HTTP::redirect($next_page);
}
示例9: __construct
/**
* Constructor
*
* Reads project's and default .ini file, sets project handler's
* and initializes paths.
* @param location config file
*/
public function __construct($plugin)
{
parent::__construct();
$this->plugin = $plugin;
$this->template = array();
$this->templateFile = "newslettersettings.tpl";
$this->basePath = realpath(dirname(__FILE__) . "/../") . "/";
$this->sqlParser->setSelect('select');
$this->sqlParser->setTable('newsletter_overview_settings', 'a');
$this->sqlParser->addField(new SqlField('a', 'set_tree_id', 'tree_id', 'Node', SqlParser::getTypeSelect() | SqlParser::getTypeModify() | SqlParser::PKEY, SqlField::TYPE_INTEGER, true));
$this->sqlParser->addField(new SqlField('a', 'set_tag', 'tag', 'Tag', SqlParser::getTypeSelect() | SqlParser::getTypeModify() | SqlParser::PKEY, SqlField::TYPE_STRING, true));
$this->sqlParser->addField(new SqlField('a', 'set_display', 'display', 'Display', SqlParser::getTypeSelect() | SqlParser::getTypeModify(), SqlField::TYPE_INTEGER, true));
$this->sqlParser->addField(new SqlField('a', 'set_msg_subject', 'subject', 'Onderwerp', SqlParser::getTypeSelect() | SqlParser::getTypeModify() | SqlParser::NAME, SqlField::TYPE_STRING, true));
$this->sqlParser->addField(new SqlField('a', 'set_msg_from', 'mailfrom', 'Van', SqlParser::getTypeSelect() | SqlParser::getTypeModify(), SqlField::TYPE_EMAIL, true));
$this->sqlParser->addField(new SqlField('a', 'set_msg_action', 'action', 'Action', SqlParser::getTypeSelect() | SqlParser::getTypeModify(), SqlField::TYPE_INTEGER));
$this->sqlParser->addField(new SqlField('a', 'set_msg_text', 'mailtext', 'Mail intro', SqlParser::getTypeSelect() | SqlParser::getTypeModify(), SqlField::TYPE_STRING));
$this->sqlParser->addField(new SqlField('a', 'set_msg_ref_tree_id', 'ref_tree_id', 'Referentie node', SqlParser::getTypeSelect() | SqlParser::getTypeModify(), SqlField::TYPE_INTEGER));
$this->sqlParser->addField(new SqlField('a', 'set_del_tree_id', 'del_tree_id', 'Unsubscribe Referentie node', SqlParser::getTypeSelect() | SqlParser::getTypeModify(), SqlField::TYPE_INTEGER));
$this->sqlParser->addField(new SqlField('a', 'set_msg_optin_tree_id', 'optin_tree_id', 'Referentie node opt-in', SqlParser::getTypeSelect() | SqlParser::getTypeModify(), SqlField::TYPE_INTEGER));
$this->sqlParser->addField(new SqlField('a', 'set_cap_gender', 'cap_gender', 'Caption gender', SqlParser::getTypeSelect() | SqlParser::getTypeModify(), SqlField::TYPE_STRING, true));
$this->sqlParser->addField(new SqlField('a', 'set_cap_name', 'cap_name', 'Caption name', SqlParser::getTypeSelect() | SqlParser::getTypeModify(), SqlField::TYPE_STRING, true));
$this->sqlParser->addField(new SqlField('a', 'set_cap_email', 'cap_email', 'Caption email', SqlParser::getTypeSelect() | SqlParser::getTypeModify(), SqlField::TYPE_STRING, false));
$this->sqlParser->addField(new SqlField('a', 'set_cap_submit', 'cap_submit', 'Caption submit button', SqlParser::getTypeSelect() | SqlParser::getTypeModify(), SqlField::TYPE_STRING));
$this->sqlParser->addField(new SqlField('a', 'set_field_width', 'field_width', 'Field width', SqlParser::getTypeSelect() | SqlParser::getTypeModify(), SqlField::TYPE_INTEGER, true));
$this->sqlParser->addField(new SqlField('a', 'set_usr_id', 'usr_id', 'User', SqlParser::getTypeSelect() | SqlParser::getTypeModify(), SqlField::TYPE_INTEGER, true));
$this->sqlParser->addField(new SqlField('a', 'set_own_id', 'own_id', 'Owner', SqlParser::getTypeSelect() | SqlParser::MOD_INSERT, SqlField::TYPE_INTEGER, true));
$this->sqlParser->addField(new SqlField('a', 'set_create', 'createdate', 'Created', SqlParser::getTypeSelect() | SqlParser::MOD_INSERT, SqlField::TYPE_DATE, true));
$this->sqlParser->addField(new SqlField('a', 'set_ts', 'ts', 'Modified', SqlParser::getTypeSelect(), SqlField::TYPE_DATE));
}
示例10: __construct
/**
* Constructor
*
* Reads project's and default .ini file, sets project handler's
* and initializes paths.
* @param location config file
*/
public function __construct($plugin)
{
parent::__construct();
$this->plugin = $plugin;
$this->importing = false;
$this->template = array();
$this->templateFile = "attachmentoverview.tpl";
$this->basePath = realpath(dirname(__FILE__) . "/../") . "/";
$this->sqlParser->setSelect('select');
$this->sqlParser->setTable('attachment', 'a');
$this->sqlParser->addField(new SqlField('a', 'att_id', 'id', 'id', SqlParser::getTypeSelect() | SqlParser::PKEY, SqlField::TYPE_INTEGER));
$this->sqlParser->addField(new SqlField('a', 'att_tree_id', 'tree_id', 'Node', SqlParser::getTypeSelect() | SqlParser::getTypeModify(), SqlField::TYPE_INTEGER, true));
$this->sqlParser->addField(new SqlField('a', 'att_tag', 'tag', 'Tag', SqlParser::getTypeSelect() | SqlParser::getTypeModify(), SqlField::TYPE_STRING, true));
$this->sqlParser->addField(new SqlField('a', 'att_ref_id', 'ref_id', 'Referentie', SqlParser::getTypeSelect() | SqlParser::getTypeModify(), SqlField::TYPE_INTEGER, false));
$this->sqlParser->addField(new SqlField('a', 'att_weight', 'weight', 'Index', SqlParser::getTypeSelect() | SqlParser::getTypeModify(), SqlField::TYPE_INTEGER));
$this->sqlParser->addField(new SqlField('a', 'att_active', 'active', 'Actieve status', SqlParser::getTypeSelect() | SqlParser::getTypeModify(), SqlField::TYPE_BOOLEAN));
$this->sqlParser->addField(new SqlField('a', 'att_online', 'online', 'Online datum', SqlParser::getTypeSelect() | SqlParser::getTypeModify(), SqlField::TYPE_DATE, true));
$this->sqlParser->addField(new SqlField('a', 'att_offline', 'offline', 'Offline datum', SqlParser::getTypeSelect() | SqlParser::getTypeModify(), SqlField::TYPE_DATE));
$this->sqlParser->addField(new SqlField('a', 'att_name', 'name', 'Naam', SqlParser::getTypeSelect() | SqlParser::getTypeModify() | SqlParser::NAME, SqlField::TYPE_STRING, true));
$this->sqlParser->addField(new SqlField('a', 'att_intro', 'intro', 'Introductie', SqlParser::getTypeSelect() | SqlParser::getTypeModify(), SqlField::TYPE_STRING));
$this->sqlParser->addField(new SqlField('a', 'att_file', 'file', 'Bestand', SqlParser::getTypeSelect(), SqlField::TYPE_STRING));
$this->sqlParser->addField(new SqlField('a', 'att_usr_id', 'usr_id', 'Gebruiker', SqlParser::getTypeSelect() | SqlParser::getTypeModify(), SqlField::TYPE_INTEGER, true));
$this->sqlParser->addField(new SqlField('a', 'att_own_id', 'own_id', 'Eigenaar', SqlParser::getTypeSelect() | SqlParser::MOD_INSERT, SqlField::TYPE_INTEGER, true));
$this->sqlParser->addField(new SqlField('a', 'att_create', 'createdate', 'Creatie', SqlParser::getTypeSelect() | SqlParser::MOD_INSERT, SqlField::TYPE_DATE, true));
$this->sqlParser->addField(new SqlField('a', 'att_ts', 'ts', 'Gewijzigd', SqlParser::getTypeSelect(), SqlField::TYPE_DATE));
$this->orderStatement = array(Attachment::ORDER_ASC => 'order by a.att_weight asc, a.att_name asc', Attachment::ORDER_DESC => 'order by a.att_weight desc, a.att_name asc', Attachment::ORDER_RAND => "order by rand()");
}
示例11: __construct
public function __construct()
{
parent::__construct();
$this->template = array();
$this->templateFile = "logging.tpl";
$this->basePath = realpath(dirname(__FILE__) . "/../") . "/";
}
示例12: __construct
public function __construct()
{
parent::__construct();
$this->usergroup = new SystemUserGroup();
$this->sqlParser->setSelect('select');
$this->sqlParser->setTable('users', 'a');
$this->sqlParser->addField(new SqlField('a', 'usr_id', 'id', 'Identifier', SqlParser::getTypeSelect() | SqlParser::PKEY, SqlField::TYPE_INTEGER));
$this->sqlParser->addField(new SqlField('a', 'usr_active', 'active', 'Actieve status', SqlParser::getTypeSelect() | SqlParser::getTypeModify(), SqlField::TYPE_BOOLEAN));
$this->sqlParser->addField(new SqlField('a', 'usr_notify', 'notify', 'Notify actions', SqlParser::getTypeSelect() | SqlParser::getTypeModify(), SqlField::TYPE_BOOLEAN));
$this->sqlParser->addField(new SqlField('a', 'usr_role', 'role', 'User Role', SqlParser::getTypeSelect() | SqlParser::getTypeModify(), SqlField::TYPE_INTEGER, true));
$this->sqlParser->addField(new SqlField('a', 'usr_name', 'name', 'AchterNaam', SqlParser::getTypeSelect() | SqlParser::getTypeModify() | SqlParser::NAME, SqlField::TYPE_STRING, true));
$this->sqlParser->addField(new SqlField('a', 'usr_firstname', 'firstname', 'Voornaam', SqlParser::getTypeSelect() | SqlParser::getTypeModify() | SqlParser::NAME, SqlField::TYPE_STRING));
$this->sqlParser->addField(new SqlField('a', 'usr_address', 'address', 'Adres', SqlParser::getTypeSelect() | SqlParser::getTypeModify(), SqlField::TYPE_STRING));
$this->sqlParser->addField(new SqlField('a', 'usr_address_nr', 'address_nr', 'Huisnummer', SqlParser::getTypeSelect() | SqlParser::getTypeModify(), SqlField::TYPE_STRING));
$this->sqlParser->addField(new SqlField('a', 'usr_zipcode', 'zipcode', 'Postcode', SqlParser::getTypeSelect() | SqlParser::getTypeModify(), SqlField::TYPE_STRING));
$this->sqlParser->addField(new SqlField('a', 'usr_city', 'city', 'Plaats', SqlParser::getTypeSelect() | SqlParser::getTypeModify(), SqlField::TYPE_STRING));
$this->sqlParser->addField(new SqlField('a', 'usr_country', 'country', 'Land', SqlParser::getTypeSelect() | SqlParser::getTypeModify(), SqlField::TYPE_STRING));
$this->sqlParser->addField(new SqlField('a', 'usr_phone', 'phone', 'Telefoon', SqlParser::getTypeSelect() | SqlParser::getTypeModify(), SqlField::TYPE_PHONE));
$this->sqlParser->addField(new SqlField('a', 'usr_mobile', 'mobile', 'Mobiel nummer', SqlParser::getTypeSelect() | SqlParser::getTypeModify(), SqlField::TYPE_PHONE));
$this->sqlParser->addField(new SqlField('a', 'usr_email', 'email', 'Email', SqlParser::getTypeSelect() | SqlParser::getTypeModify(), SqlField::TYPE_EMAIL, true));
$this->sqlParser->addField(new SqlField('a', 'usr_username', 'username', 'Gebruikersnaam', SqlParser::getTypeSelect() | SqlParser::getTypeModify() | SqlParser::SEL_USERNAME, SqlField::TYPE_STRING, true));
$this->sqlParser->addField(new SqlField('a', 'usr_password', 'password', 'Wachtwoord', SqlParser::getTypeSelect() | SqlParser::MOD_INSERT | SqlParser::SEL_PASSWORD, SqlField::TYPE_STRING, false));
$this->sqlParser->addField(new SqlField('a', 'usr_logincount', 'logincount', 'Aantal logins', SqlParser::getTypeSelect(), SqlField::TYPE_INTEGER));
$this->sqlParser->addField(new SqlField('a', 'usr_logindate', 'logindate', 'Laatste login', SqlParser::getTypeSelect(), SqlField::TYPE_DATE));
$this->sqlParser->addField(new SqlField('a', 'usr_create', 'createdate', 'Creatie', SqlParser::getTypeSelect() | SqlParser::MOD_INSERT, SqlField::TYPE_DATE));
$this->orderStatement = array('order by a.usr_name asc, a.usr_firstname asc');
}
示例13: __construct
/**
* Constructor
*
* Reads project's and default .ini file, sets project handler's
* and initializes paths.
* @param location config file
*/
public function __construct($plugin)
{
parent::__construct();
$this->plugin = $plugin;
$this->template = array();
$this->templateFile = "reservationoverview.tpl";
$this->basePath = realpath(dirname(__FILE__) . "/../") . "/";
$this->sqlParser->setSelect('select');
$this->sqlParser->setTable('reservation', 'a');
$this->sqlParser->addField(new SqlField('a', 'res_id', 'id', 'id', SqlParser::getTypeSelect() | SqlParser::PKEY, SqlField::TYPE_INTEGER));
$this->sqlParser->addField(new SqlField('a', 'res_tree_id', 'tree_id', 'Node', SqlParser::getTypeSelect() | SqlParser::getTypeModify(), SqlField::TYPE_INTEGER, true));
$this->sqlParser->addField(new SqlField('a', 'res_tag', 'tag', 'Tag', SqlParser::getTypeSelect() | SqlParser::getTypeModify(), SqlField::TYPE_STRING, true));
$this->sqlParser->addField(new SqlField('a', 'res_active', 'active', 'Actieve status', SqlParser::getTypeSelect() | SqlParser::getTypeModify(), SqlField::TYPE_BOOLEAN));
$this->sqlParser->addField(new SqlField('b', 'usr_name', 'name', 'AchterNaam', SqlParser::getTypeSelect() | SqlParser::NAME, SqlField::TYPE_STRING));
$this->sqlParser->addField(new SqlField('b', 'usr_firstname', 'firstname', 'Voornaam', SqlParser::getTypeSelect() | SqlParser::NAME, SqlField::TYPE_STRING));
$this->sqlParser->addField(new SqlField('a', 'res_usr_id', 'usr_id', 'User', SqlParser::getTypeSelect() | SqlParser::getTypeModify(), SqlField::TYPE_INTEGER, true));
$this->sqlParser->addField(new SqlField('a', 'res_date', 'reservation_date', 'Date', SqlParser::getTypeSelect() | SqlParser::getTypeModify() | SqlParser::NAME, SqlField::TYPE_DATE));
$this->sqlParser->addField(new SqlField('a', 'res_time', 'reservation_time', 'Time', SqlParser::getTypeSelect() | SqlParser::getTypeModify() | SqlParser::NAME, SqlField::TYPE_STRING));
$this->sqlParser->addField(new SqlField('a', 'res_vip', 'vip', 'VIP reservation', SqlParser::getTypeSelect() | SqlParser::getTypeModify(), SqlField::TYPE_BOOLEAN));
$this->sqlParser->addField(new SqlField('a', 'res_own_id', 'own_id', 'Owner', SqlParser::getTypeSelect() | SqlParser::MOD_INSERT, SqlField::TYPE_INTEGER, true));
$this->sqlParser->addField(new SqlField('a', 'res_create', 'createdate', 'Created', SqlParser::getTypeSelect() | SqlParser::MOD_INSERT, SqlField::TYPE_DATE, true));
$this->sqlParser->addField(new SqlField('a', 'res_ts', 'ts', 'Modified', SqlParser::getTypeSelect(), SqlField::TYPE_DATE));
$this->sqlParser->addFrom('left join users as b on b.usr_id = a.res_usr_id');
$this->orderStatement = array(self::ORDER_TIME_ASC => 'order by a.res_date %s, a.res_time asc , b.usr_name asc', self::ORDER_TIME_DESC => 'order by a.res_date %s, a.res_time desc , b.usr_name asc');
}
示例14: __construct
/**
* Constructor
*
* Reads project's and default .ini file, sets project handler's
* and initializes paths.
* @param location config file
*/
public function __construct($plugin)
{
parent::__construct();
$this->plugin = $plugin;
$this->template = array();
$this->templateFile = "newslettertag.tpl";
$this->basePath = realpath(dirname(__FILE__) . "/../") . "/";
$this->sqlParser->setSelect('select');
$this->sqlParser->setTable('newsletter_tag', 'a');
$this->sqlParser->addField(new SqlField('b', 'nl_name', 'name', 'Newsletter title', SqlParser::getTypeSelect() | SqlParser::NAME, SqlField::TYPE_STRING, false));
$this->sqlParser->addField(new SqlField('a', 'tag_nl_id', 'nl_id', 'NewsLetter id', SqlParser::getTypeSelect() | SqlParser::getTypeModify() | SqlParser::PKEY, SqlField::TYPE_INTEGER, true));
$this->sqlParser->addField(new SqlField('a', 'tag_parent_tag', 'parent_tag', 'Parent tag name', SqlParser::getTypeSelect() | SqlParser::getTypeModify() | SqlParser::PKEY | SqlParser::NAME, SqlField::TYPE_STRING, true));
$this->sqlParser->addField(new SqlField('b', 'nl_tree_id', 'tree_id', 'Node', SqlParser::getTypeSelect(), SqlField::TYPE_INTEGER, false));
$this->sqlParser->addField(new SqlField('b', 'nl_tag', 'tag', 'Tag', SqlParser::getTypeSelect(), SqlField::TYPE_STRING, false));
$this->sqlParser->addField(new SqlField('a', 'tag_tags', 'tags', 'Replacement tags', SqlParser::getTypeSelect() | SqlParser::getTypeModify(), SqlField::TYPE_STRING));
$this->sqlParser->addField(new SqlField('a', 'tag_template', 'template', 'Template', SqlParser::getTypeSelect() | SqlParser::getTypeModify(), SqlField::TYPE_STRING));
$this->sqlParser->addField(new SqlField('a', 'tag_stylesheet', 'stylesheet', 'Stylesheet', SqlParser::getTypeSelect() | SqlParser::getTypeModify(), SqlField::TYPE_STRING));
$this->sqlParser->addField(new SqlField('a', 'tag_usr_id', 'usr_id', 'User', SqlParser::getTypeSelect() | SqlParser::getTypeModify(), SqlField::TYPE_INTEGER, true));
$this->sqlParser->addField(new SqlField('a', 'tag_own_id', 'own_id', 'Owner', SqlParser::getTypeSelect() | SqlParser::MOD_INSERT, SqlField::TYPE_INTEGER, true));
$this->sqlParser->addField(new SqlField('a', 'tag_create', 'createdate', 'Create date', SqlParser::getTypeSelect() | SqlParser::MOD_INSERT, SqlField::TYPE_DATE, true));
$this->sqlParser->addField(new SqlField('a', 'tag_ts', 'ts', 'Modified', SqlParser::getTypeSelect(), SqlField::TYPE_DATE));
$this->sqlParser->addFrom("inner join newsletter as b on b.nl_id = a.tag_nl_id");
//$this->orderStatement = array('order by a.tag_tag %s');
$this->settings = array();
}
示例15: __construct
/**
* Constructor
*
* Reads project's and default .ini file, sets project handler's
* and initializes paths.
* @param location config file
*/
public function __construct($plugin)
{
parent::__construct();
$this->plugin = $plugin;
$this->importing = false;
$this->template = array();
$this->templateFile = "galleryoverview.tpl";
$this->basePath = realpath(dirname(__FILE__) . "/../") . "/";
$this->reference = array();
$this->sqlParser->setSelect('select');
$this->sqlParser->setTable('gallery', 'a');
$this->sqlParser->addField(new SqlField('a', 'gal_id', 'id', 'id', SqlParser::getTypeSelect() | SqlParser::PKEY, SqlField::TYPE_INTEGER));
$this->sqlParser->addField(new SqlField('a', 'gal_tree_id', 'tree_id', 'Node', SqlParser::getTypeSelect() | SqlParser::getTypeModify(), SqlField::TYPE_INTEGER, true));
$this->sqlParser->addField(new SqlField('a', 'gal_tag', 'tag', 'Tag', SqlParser::getTypeSelect() | SqlParser::getTypeModify(), SqlField::TYPE_STRING, true));
$this->sqlParser->addField(new SqlField('a', 'gal_weight', 'weight', 'Gewicht', SqlParser::getTypeSelect() | SqlParser::getTypeModify(), SqlField::TYPE_INTEGER));
$this->sqlParser->addField(new SqlField('a', 'gal_active', 'active', 'Actieve status', SqlParser::getTypeSelect() | SqlParser::getTypeModify(), SqlField::TYPE_BOOLEAN));
$this->sqlParser->addField(new SqlField('a', 'gal_active', 'activated', 'Geactiveerd', SqlParser::getTypeSelect(), SqlField::TYPE_BOOLEAN));
$this->sqlParser->addField(new SqlField('a', 'gal_name', 'name', 'Naam', SqlParser::getTypeSelect() | SqlParser::getTypeModify() | SqlParser::NAME, SqlField::TYPE_STRING, true));
$this->sqlParser->addField(new SqlField('a', 'gal_description', 'description', 'Introductie', SqlParser::getTypeSelect() | SqlParser::getTypeModify(), SqlField::TYPE_STRING));
$this->sqlParser->addField(new SqlField('a', 'gal_thumbnail', 'thumbnail', 'Afbeelding', SqlParser::getTypeSelect(), SqlField::TYPE_STRING));
$this->sqlParser->addField(new SqlField('a', 'gal_image', 'image', 'Afbeelding', SqlParser::getTypeSelect(), SqlField::TYPE_STRING));
$this->sqlParser->addField(new SqlField('a', 'gal_img_x', 'img_x', 'Offset x', SqlParser::getTypeSelect() | SqlParser::getTypeModify(), SqlField::TYPE_INTEGER));
$this->sqlParser->addField(new SqlField('a', 'gal_img_y', 'img_y', 'Offset y', SqlParser::getTypeSelect() | SqlParser::getTypeModify(), SqlField::TYPE_INTEGER));
$this->sqlParser->addField(new SqlField('a', 'gal_img_width', 'img_width', 'Offset width', SqlParser::getTypeSelect() | SqlParser::getTypeModify(), SqlField::TYPE_INTEGER));
$this->sqlParser->addField(new SqlField('a', 'gal_img_height', 'img_height', 'Offset height', SqlParser::getTypeSelect() | SqlParser::getTypeModify(), SqlField::TYPE_INTEGER));
$this->sqlParser->addField(new SqlField('a', 'gal_usr_id', 'usr_id', 'Gebruiker', SqlParser::getTypeSelect() | SqlParser::getTypeModify(), SqlField::TYPE_INTEGER, true));
$this->sqlParser->addField(new SqlField('a', 'gal_own_id', 'own_id', 'Eigenaar', SqlParser::getTypeSelect() | SqlParser::MOD_INSERT, SqlField::TYPE_INTEGER, true));
$this->sqlParser->addField(new SqlField('a', 'gal_create', 'createdate', 'Creatie', SqlParser::getTypeSelect() | SqlParser::MOD_INSERT, SqlField::TYPE_DATE, true));
$this->sqlParser->addField(new SqlField('a', 'gal_ts', 'ts', 'Gewijzigd', SqlParser::getTypeSelect(), SqlField::TYPE_DATE));
$this->orderStatement = array(Gallery::ORDER_LINEAR => 'order by a.gal_weight asc, a.gal_create asc', Gallery::ORDER_RANDOM => "order by rand()", Gallery::ORDER_PREVIOUS => 'order by a.gal_weight desc, a.gal_create asc');
}