private static function getSetting($widgetUrl) { $name = $widgetUrl; if ($name === false) { return array(); } $afUser = sfContext::getInstance()->getUser()->getAppFlowerUser(); if (!$afUser->isAnonymous()) { $userId = $afUser->getId(); } else { return array(); } $c = new Criteria(); $c->add(afWidgetSettingPeer::USER, $userId); $c->add(afWidgetSettingPeer::NAME, $name); $obj = afWidgetSettingPeer::doSelectOne($c); if ($obj === null) { return array(); } $setting = json_decode($obj->getSetting(), true); return $setting; }
public static function getSettingByName($name) { $user_id = sfContext::getInstance()->getUser()->getAppFlowerUser()->getId(); $setting = GraphUtil::getDefaultSettingByName($name); $c = new Criteria(); $c->add(afWidgetSettingPeer::USER, $user_id); $c->add(afWidgetSettingPeer::NAME, $name); $obj = afWidgetSettingPeer::doSelectOne($c); if ($obj) { $setting = json_decode($obj->getSetting(), true); } return $setting; }