Skip to content

Commit

Permalink
Dev: sid in SurveyDynamic and TokenDynamic are static …
Browse files Browse the repository at this point in the history
  • Loading branch information
Shnoulle committed Oct 6, 2018
1 parent fd7911f commit 6bb4566
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 13 deletions.
3 changes: 2 additions & 1 deletion application/models/Response.php
Expand Up @@ -188,8 +188,9 @@ public function tableName()
* @return int
*/
public function getSurveyId() {
return $this->dynamicId;
return $this->getDynamicId();
}

public function browse()
{
}
Expand Down
2 changes: 1 addition & 1 deletion application/models/SurveyDynamic.php
Expand Up @@ -919,6 +919,6 @@ public function getPrintAnswersArray($sSRID, $sLanguage, $bHonorConditions = fal
* @return int
*/
public function getSurveyId() {
return $this->sid;
return self::$sid;
}
}
2 changes: 1 addition & 1 deletion application/models/Token.php
Expand Up @@ -385,6 +385,6 @@ public function tableName()
* @return int
*/
public function getSurveyId() {
return $this->dynamicId;
return $this->getDynamicId();
}
}
2 changes: 1 addition & 1 deletion application/models/TokenDynamic.php
Expand Up @@ -1019,6 +1019,6 @@ public function search()
* @return int
*/
public function getSurveyId() {
return $this->sid;
return self::$sid;
}
}
22 changes: 13 additions & 9 deletions application/models/behaviors/PluginEventBehavior.php
Expand Up @@ -45,31 +45,35 @@ public function beforeSave(CModelEvent $event)
* @param string $what
* @return PluginEvent the dispatched event
*/
private function _dispatchDynamic($when,$what) {
if(is_subclass_of($this->owner,'Dynamic'))
{
$oPluginEvent = new PluginEvent($when.get_parent_class($this->owner).$what, $this);
$oPluginEvent->set('model', $this->owner);
$oPluginEvent->set('dynamicId', $this->owner->getDynamicId());
return App()->getPluginManager()->dispatchEvent($oPluginEvent);
private function _dispatchDynamic($when,$what)
{
if(is_subclass_of($this->owner,'Dynamic')) {
$params = array(
'dynamicId' => $this->owner->getDynamicId()
);
return $this->dispatchPluginModelEvent($when.get_parent_class($this->owner).$what,null,$params);
}
}
/**
* method for dispatching plugin events
*
* See {@link find()} for detailed explanation about $condition and $params.
* @param string $sEventName event name to dispatch
* @param array $criteria array containing attributes, conditions and params for the filter query
* @param array $criteria array containing attributes, conditions and params for the filter query
* @param array $eventParams array of params for event
* @return PluginEvent the dispatched event
*/
public function dispatchPluginModelEvent($sEventName, $criteria = null)
public function dispatchPluginModelEvent($sEventName, $criteria = null, $eventParams = array())
{
$oPluginEvent = new PluginEvent($sEventName, $this);
$oPluginEvent->set('model', $this->owner);
if(method_exists($this->owner,'getSurveyId')) {
$oPluginEvent->set('iSurveyID', $this->owner->getSurveyId());
$oPluginEvent->set('surveyId', $this->owner->getSurveyId());
}
foreach($eventParams as $param => $value) {
$oPluginEvent->set($param, $value);
}
if (isset($criteria)) {
$oPluginEvent->set('filterCriteria', $criteria);
}
Expand Down

1 comment on commit 6bb4566

@Shnoulle
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Never work on week-end …

Please sign in to comment.