Index: custom/units/sections/e_link_tp.php
===================================================================
--- custom/units/sections/e_link_tp.php (revision 12951)
+++ custom/units/sections/e_link_tp.php (working copy)
@@ -24,33 +24,5 @@
return $o;
}
-
- /**
- * Variantion of overriding Field method for Link
- *
- * @param Array $params
- * @return string
- */
- function Field($params)
- {
- $object =& $this->getObject($params);
- /* @var $object kDBItem */
-
- $o = '';
-
- // do some custom stuff here
- if ( $object->isLoaded() ) {
- $o = $object->GetField($this->SelectParam($params, 'name,field') ); #field Formatter applied
-
-// $o = $object->GetDBField($this->SelectParam($params, 'name,field') ); #field Formatter NOT applied
- }
-
- // in case if no data found
- if ($o != '') {
- $this->Application->Parser->DataExists = true;
- }
-
- return $o;
- }
-
+
}
\ No newline at end of file
Index: custom/units/sections/e_article_tp.php
===================================================================
--- custom/units/sections/e_article_tp.php (revision 0)
+++ custom/units/sections/e_article_tp.php (revision 0)
@@ -0,0 +1,28 @@
+<?php
+
+ defined('FULL_PATH') or die('restricted access!');
+
+ /**
+ * Extends default ArticlesTagProcessor class
+ *
+ */
+ class EArticleTagProcessor extends ArticlesTagProcessor {
+
+ /**
+ * Adding custom processing to existing Field method
+ *
+ * @param Array $params
+ * @return string
+ */
+ function FormattedField($params)
+ {
+ // get from parent
+ $o = parent::Field($params);
+
+ // do some custom stuff here
+ $o = trim($o);
+
+ return $o;
+ }
+
+ }
\ No newline at end of file
Index: custom/units/sections/e_product_tp.php
===================================================================
--- custom/units/sections/e_product_tp.php (revision 12951)
+++ custom/units/sections/e_product_tp.php (working copy)
@@ -8,15 +8,15 @@
*/
class EProductTagProcessor extends ProductsTagProcessor {
-
/**
* Adding custom processing to existing Field method
*
* @param Array $params
* @return string
*/
- function Field($params)
+ function FormattedField($params)
{
+ // get from parent
$o = parent::Field($params);
// do some custom stuff here
Index: custom/units/sections/e_product_eh.php
===================================================================
--- custom/units/sections/e_product_eh.php (revision 12951)
+++ custom/units/sections/e_product_eh.php (working copy)
@@ -9,7 +9,7 @@
class EProductEventHandler extends ProductsEventHandler {
/**
- * Allows to override standart permission mapping
+ * Allows to override standard permission mapping
*
*/
function mapPermissions()
Index: custom/units/sections/sections_config.php
===================================================================
--- custom/units/sections/sections_config.php (revision 12951)
+++ custom/units/sections/sections_config.php (working copy)
@@ -7,7 +7,7 @@
* @package Custom (Development Kit)
*/
-defined('FULL_PATH') or die('restricted access!');
+ defined('FULL_PATH') or die('restricted access!');
$config = Array (
@@ -35,7 +35,16 @@
# extend default Link /in-link/units/links/link_tag_processor.php / links_event_handler.php
// Array ('pseudo' => 'l_TagProcessor', 'class' => 'ELinkTagProcessor', 'file' => 'e_link_tp.php'),
// Array ('pseudo' => 'l_EventHandler', 'class' => 'ELinkEventHandler', 'file' => 'e_link_eh.php'),
-
+
+ # extend default Category /core/units/categories/categories_tag_processor.php / categories_event_handler.php
+// Array ('pseudo' => 'c_TagProcessor', 'class' => 'ECategoryTagProcessor', 'file' => 'e_category_tp.php'),
+// Array ('pseudo' => 'c_EventHandler', 'class' => 'ECategoryEventHandler', 'file' => 'e_category_eh.php'),
+
+ # extend default Article /in-news/units/articles/article_tag_processor.php / articles_event_handler.php
+// Array ('pseudo' => 'n_TagProcessor', 'class' => 'EArticleTagProcessor', 'file' => 'e_article_tp.php'),
+// Array ('pseudo' => 'n_EventHandler', 'class' => 'EArticleEventHandler', 'file' => 'e_article_eh.php'),
+// Array ('pseudo' => 'n-rev_EventHandler', 'class' => 'EReviewEventHandler', 'file' => 'e_review_eh.php'),
+
),
# Replace/substiture any admin default templates with custom ones
Index: custom/units/sections/e_category_tp.php
===================================================================
--- custom/units/sections/e_category_tp.php (revision 0)
+++ custom/units/sections/e_category_tp.php (revision 0)
@@ -0,0 +1,28 @@
+<?php
+
+ defined('FULL_PATH') or die('restricted access!');
+
+ /**
+ * Extends default CategoriesTagProcessor class
+ *
+ */
+ class ECategoryTagProcessor extends CategoriesTagProcessor {
+
+ /**
+ * Adding custom processing to existing Field method
+ *
+ * @param Array $params
+ * @return string
+ */
+ function FormattedField($params)
+ {
+ // get from parent
+ $o = parent::Field($params);
+
+ // do some custom stuff here
+ $o = trim($o);
+
+ return $o;
+ }
+
+ }
\ No newline at end of file
Index: custom/units/sections/e_review_eh.php
===================================================================
--- custom/units/sections/e_review_eh.php (revision 0)
+++ custom/units/sections/e_review_eh.php (revision 0)
@@ -0,0 +1,127 @@
+<?php
+
+ defined('FULL_PATH') or die('restricted access!');
+
+ /**
+ * Extends/overrides methods of default ReviewsEventHandler class
+ *
+ */
+
+ class EReviewEventHandler extends ReviewsEventHandler {
+ /**
+ * Makes left join to item's table, when in separate grid
+ *
+ * @param kEvent $event
+ */
+ function OnAfterConfigRead(&$event)
+ {
+ parent::OnAfterConfigRead($event);
+
+ // 1. add fields
+// $fields = $this->Application->getUnitOption($event->Prefix, 'Fields');
+// $this->Application->setUnitOption($event->Prefix, 'Fields', $fields);
+
+ // 2. calculated fields
+// $calculated_fields = $this->Application->getUnitOption($event->Prefix, 'CalculatedFields');
+// $this->Application->setUnitOption($event->Prefix, 'CalculatedFields', $calculated_fields);
+ }
+
+
+ /**
+ * Before new item created
+ *
+ * @param kEvent $event
+ */
+ function OnBeforeItemCreate(&$event)
+ {
+ parent::OnBeforeItemCreate($event);
+
+
+ }
+
+ /**
+ * Before existing item updated
+ *
+ * @param kEvent $event
+ */
+ function OnBeforeItemUpdate(&$event)
+ {
+ parent::OnBeforeItemUpdate($event);
+
+
+ }
+
+ /**
+ * Before item deleted
+ *
+ * @param kEvent $event
+ */
+ function OnBeforeItemDelete(&$event)
+ {
+ parent::OnBeforeItemDelete($event);
+
+
+ }
+
+ /**
+ * After item loaded
+ *
+ * @param kEvent $event
+ */
+ function OnBeforeItemLoad(&$event)
+ {
+ parent::OnBeforeItemLoad($event);
+
+
+ }
+
+
+ /**
+ * After new item created
+ *
+ * @param kEvent $event
+ */
+ function OnAfterItemCreate(&$event)
+ {
+ parent::OnAfterItemCreate($event);
+
+
+ }
+
+ /**
+ * After existing item updated
+ *
+ * @param kEvent $event
+ */
+ function OnAfterItemUpdate(&$event)
+ {
+ parent::OnAfterItemUpdate($event);
+
+
+ }
+
+ /**
+ * After item deleted
+ *
+ * @param kEvent $event
+ */
+ function OnAfterItemDelete(&$event)
+ {
+ parent::OnAfterItemDelete($event);
+
+
+ }
+
+ /**
+ * After item loaded
+ *
+ * @param kEvent $event
+ */
+ function OnAfterItemLoad(&$event)
+ {
+ parent::OnAfterItemLoad($event);
+
+
+ }
+
+ }
\ No newline at end of file
Index: custom/units/sections/e_user_eh.php
===================================================================
--- custom/units/sections/e_user_eh.php (revision 12951)
+++ custom/units/sections/e_user_eh.php (working copy)
@@ -9,7 +9,7 @@
class EUserEventHandler extends UsersEventHandler {
/**
- * Allows to override standart permission mapping
+ * Allows to override standard permission mapping
*
*/
function mapPermissions()
Index: custom/units/sections/e_article_eh.php
===================================================================
--- custom/units/sections/e_article_eh.php (revision 0)
+++ custom/units/sections/e_article_eh.php (revision 0)
@@ -0,0 +1,188 @@
+<?php
+
+ defined('FULL_PATH') or die('restricted access!');
+
+ /**
+ * Extends default ArticlesEventHandler class
+ *
+ */
+ class EArticleEventHandler extends ArticlesEventHandler {
+
+ /**
+ * Allows to override standard permission mapping
+ *
+ */
+ function mapPermissions()
+ {
+ parent::mapPermissions();
+
+ $permissions = Array (
+ # admin
+ 'OnCustomEvent1' => Array ('self' => true),
+
+ # front
+ 'OnCustomEvent2' => Array ('self' => true),
+ );
+
+ $this->permMapping = array_merge($this->permMapping, $permissions);
+ }
+
+ /**
+ * Permission exceptions
+ *
+ * @param kEvent $event
+ */
+ function CheckPermission(&$event)
+ {
+ $skip_permissions_check_events = Array (
+ 'OnAnotherCustomEvent',
+ );
+
+ if ( in_array($event->Name, $skip_permissions_check_events) ) {
+ return true;
+ }
+
+ return parent::CheckPermission($event);
+ }
+
+ /**
+ * Updates structure config
+ *
+ * @param kEvent $event
+ */
+ function OnAfterConfigRead(&$event)
+ {
+ parent::OnAfterConfigRead($event);
+
+ # 1. Regular Fields from
+ $fields = $this->Application->getUnitOption($event->Prefix, 'Fields'); #get regular fields
+// $fields['Status']['default'] = 1; #add/edit configuration (make default = 1)
+ $this->Application->setUnitOption($event->Prefix, 'Fields', $fields); #save fields
+
+ # 2. Virtual Fields from /in-link/units/links/links_config.php
+ $virtual_fields = $this->Application->getUnitOption($event->Prefix, 'VirtualFields'); #get virtual fields
+// $virtual_fields['UserName']['default'] = ''; #add/edit configuration
+ $this->Application->setUnitOption($event->Prefix, 'VirtualFields', $virtual_fields); #save virtual fields
+ }
+
+ /**
+ * Sets custom query for the list
+ *
+ * @param kEvent $event
+ */
+ function SetCustomQuery(&$event)
+ {
+ parent::SetCustomQuery($event);
+
+ $object =& $event->getObject();
+ /* @var $object kDBList */
+
+ # identifying event based on special and setting filter
+ if ($event->Special == 'custom-special') {
+// $object->addFilter('primary_filter', '%1$s.Status = ' . STATUS_DISABLED);
+ }
+
+ # identifying event based not admin condition and setting filter
+ if (!$this->Application->isAdminUser) {
+// $object->addFilter('status_filter', '%1$s.Status = ' . STATUS_ACTIVE);
+ }
+ }
+
+ /**
+ * Before new item created
+ *
+ * @param kEvent $event
+ */
+ function OnBeforeItemCreate(&$event)
+ {
+ parent::OnBeforeItemCreate($event);
+
+
+ }
+
+ /**
+ * Before existing item updated
+ *
+ * @param kEvent $event
+ */
+ function OnBeforeItemUpdate(&$event)
+ {
+ parent::OnBeforeItemUpdate($event);
+
+
+ }
+
+ /**
+ * Before item deleted
+ *
+ * @param kEvent $event
+ */
+ function OnBeforeItemDelete(&$event)
+ {
+ parent::OnBeforeItemDelete($event);
+
+
+ }
+
+ /**
+ * After item loaded
+ *
+ * @param kEvent $event
+ */
+ function OnBeforeItemLoad(&$event)
+ {
+ parent::OnBeforeItemLoad($event);
+
+
+ }
+
+
+ /**
+ * After new item created
+ *
+ * @param kEvent $event
+ */
+ function OnAfterItemCreate(&$event)
+ {
+ parent::OnAfterItemCreate($event);
+
+
+ }
+
+ /**
+ * After existing item updated
+ *
+ * @param kEvent $event
+ */
+ function OnAfterItemUpdate(&$event)
+ {
+ parent::OnAfterItemUpdate($event);
+
+
+ }
+
+ /**
+ * After item deleted
+ *
+ * @param kEvent $event
+ */
+ function OnAfterItemDelete(&$event)
+ {
+ parent::OnAfterItemDelete($event);
+
+
+ }
+
+ /**
+ * After item loaded
+ *
+ * @param kEvent $event
+ */
+ function OnAfterItemLoad(&$event)
+ {
+ parent::OnAfterItemLoad($event);
+
+
+ }
+
+ }
\ No newline at end of file
Index: custom/units/sections/e_category_eh.php
===================================================================
--- custom/units/sections/e_category_eh.php (revision 0)
+++ custom/units/sections/e_category_eh.php (revision 0)
@@ -0,0 +1,188 @@
+<?php
+
+ defined('FULL_PATH') or die('restricted access!');
+
+ /**
+ * Extends default CategoriesEventHandler class
+ *
+ */
+ class ECategoryEventHandler extends CategoriesEventHandler {
+
+ /**
+ * Allows to override standard permission mapping
+ *
+ */
+ function mapPermissions()
+ {
+ parent::mapPermissions();
+
+ $permissions = Array (
+ # admin
+ 'OnCustomEvent1' => Array ('self' => true),
+
+ # front
+ 'OnCustomEvent2' => Array ('self' => true),
+ );
+
+ $this->permMapping = array_merge($this->permMapping, $permissions);
+ }
+
+ /**
+ * Permission exceptions
+ *
+ * @param kEvent $event
+ */
+ function CheckPermission(&$event)
+ {
+ $skip_permissions_check_events = Array (
+ 'OnAnotherCustomEvent',
+ );
+
+ if ( in_array($event->Name, $skip_permissions_check_events) ) {
+ return true;
+ }
+
+ return parent::CheckPermission($event);
+ }
+
+ /**
+ * Updates structure config
+ *
+ * @param kEvent $event
+ */
+ function OnAfterConfigRead(&$event)
+ {
+ parent::OnAfterConfigRead($event);
+
+ # 1. Regular Fields from
+ $fields = $this->Application->getUnitOption($event->Prefix, 'Fields'); #get regular fields
+// $fields['Status']['default'] = 1; #add/edit configuration (make default = 1)
+ $this->Application->setUnitOption($event->Prefix, 'Fields', $fields); #save fields
+
+ # 2. Virtual Fields from /in-link/units/links/links_config.php
+ $virtual_fields = $this->Application->getUnitOption($event->Prefix, 'VirtualFields'); #get virtual fields
+// $virtual_fields['UserName']['default'] = ''; #add/edit configuration
+ $this->Application->setUnitOption($event->Prefix, 'VirtualFields', $virtual_fields); #save virtual fields
+ }
+
+ /**
+ * Sets custom query for the list
+ *
+ * @param kEvent $event
+ */
+ function SetCustomQuery(&$event)
+ {
+ parent::SetCustomQuery($event);
+
+ $object =& $event->getObject();
+ /* @var $object kDBList */
+
+ # identifying event based on special and setting filter
+ if ($event->Special == 'custom-special') {
+// $object->addFilter('primary_filter', '%1$s.Status = ' . STATUS_DISABLED);
+ }
+
+ # identifying event based not admin condition and setting filter
+ if (!$this->Application->isAdminUser) {
+// $object->addFilter('status_filter', '%1$s.Status = ' . STATUS_ACTIVE);
+ }
+ }
+
+ /**
+ * Before new item created
+ *
+ * @param kEvent $event
+ */
+ function OnBeforeItemCreate(&$event)
+ {
+ parent::OnBeforeItemCreate($event);
+
+
+ }
+
+ /**
+ * Before existing item updated
+ *
+ * @param kEvent $event
+ */
+ function OnBeforeItemUpdate(&$event)
+ {
+ parent::OnBeforeItemUpdate($event);
+
+
+ }
+
+ /**
+ * Before item deleted
+ *
+ * @param kEvent $event
+ */
+ function OnBeforeItemDelete(&$event)
+ {
+ parent::OnBeforeItemDelete($event);
+
+
+ }
+
+ /**
+ * After item loaded
+ *
+ * @param kEvent $event
+ */
+ function OnBeforeItemLoad(&$event)
+ {
+ parent::OnBeforeItemLoad($event);
+
+
+ }
+
+
+ /**
+ * After new item created
+ *
+ * @param kEvent $event
+ */
+ function OnAfterItemCreate(&$event)
+ {
+ parent::OnAfterItemCreate($event);
+
+
+ }
+
+ /**
+ * After existing item updated
+ *
+ * @param kEvent $event
+ */
+ function OnAfterItemUpdate(&$event)
+ {
+ parent::OnAfterItemUpdate($event);
+
+
+ }
+
+ /**
+ * After item deleted
+ *
+ * @param kEvent $event
+ */
+ function OnAfterItemDelete(&$event)
+ {
+ parent::OnAfterItemDelete($event);
+
+
+ }
+
+ /**
+ * After item loaded
+ *
+ * @param kEvent $event
+ */
+ function OnAfterItemLoad(&$event)
+ {
+ parent::OnAfterItemLoad($event);
+
+
+ }
+
+ }
\ No newline at end of file
Index: custom/units/sections/e_link_eh.php
===================================================================
--- custom/units/sections/e_link_eh.php (revision 12951)
+++ custom/units/sections/e_link_eh.php (working copy)
@@ -9,7 +9,7 @@
class ELinkEventHandler extends LinksEventHandler {
/**
- * Allows to override standart permission mapping
+ * Allows to override standard permission mapping
*
*/
function mapPermissions()