/**
 * This function will replace fields taken from the fields variable
 * and insert them into the passed string replacing [variableName] 
 * tokens where found.
 *
 * @param unknown_type $params
 * @param unknown_type $smarty
 * @return unknown
 */
function smarty_function_sugar_replace_vars($params, &$smarty)
{
    if (empty($params['subject'])) {
        $smarty->trigger_error("sugarvar: missing 'subject' parameter");
        return;
    }
    $fields = $smarty->get_template_vars('fields');
    $subject = $params['subject'];
    $matches = array();
    $count = preg_match_all('/\\[([^\\]]*)\\]/', $subject, $matches);
    for ($i = 0; $i < $count; $i++) {
        $match = $matches[1][$i];
        if (!empty($fields[$match]) && isset($fields[$match]['value'])) {
            $value = $fields[$match]['value'];
            if (isset($fields[$match]['type']) && $fields[$match]['type'] == 'enum' && isset($fields[$match]['options']) && isset($fields[$match]['options'][$value])) {
                $subject = str_replace($matches[0][$i], $fields[$match]['options'][$value], $subject);
            } else {
                $subject = str_replace($matches[0][$i], $value, $subject);
            }
        }
    }
    if (!empty($params['assign'])) {
        $smarty->assign($params['assign'], $subject);
        return '';
    }
    return $subject;
}
Пример #2
0
 /**
  * (non-PHPdoc)
  * @see library/Oara/Network/Oara_Network_Publisher_Interface#getTransactionList($aMerchantIds, $dStartDate, $dEndDate, $sTransactionStatus)
  */
 public function getTransactionList($merchantList = null, Zend_Date $dStartDate = null, Zend_Date $dEndDate = null, $merchantMap = null)
 {
     $totalTransactions = array();
     $urls = array();
     $url = 'http://business.skyscanner.net/apiservices/reporting/v1.0/reportdata/' . $dStartDate->toString("yyyy-MM-dd") . '/' . $dEndDate->toString("yyyy-MM-dd") . '?encryptedApiKey=' . $this->_apiKey . "&type=csv";
     $urls[] = new Oara_Curl_Request($url, array());
     $exportReport = array();
     $exportReport = $this->_client->get($urls);
     $dump = var_export($exportReport[0], true);
     $dump = preg_replace("/ \\. /", "", $dump);
     $dump = preg_replace("/\"\\\\0\"/", "", $dump);
     $dump = preg_replace("/'/", "", $dump);
     $exportData = str_getcsv($dump, "\n");
     $num = count($exportData);
     for ($i = 1; $i < $num; $i++) {
         $transactionExportArray = str_getcsv($exportData[$i], ",");
         $transaction = array();
         $transaction['merchantId'] = 1;
         $transactionDate = new Zend_Date($transactionExportArray[0], 'dd/MM/yyyy HH:mm:ss', 'en');
         $transaction['date'] = $transactionDate->toString("yyyy-MM-dd HH:mm:ss");
         //unset($transactionDate);
         $transaction['status'] = Oara_Utilities::STATUS_CONFIRMED;
         $transaction['amount'] = (double) $transactionExportArray[9];
         $transaction['commission'] = (double) $transaction['amount'] * 0.6;
         if ($transaction['amount'] != 0) {
             $totalTransactions[] = $transaction;
         }
     }
     return $totalTransactions;
 }
Пример #3
0
 /**
  * Generated all outputformats
  *
  * @param unknown_type $objectVersion
  * @return array
  */
 function getAllOutputFormatTextByContentObjectVersion($objectVersion, $forceSettingImageIncludeTo = -1)
 {
     $outputFormatTextArray = array();
     $dataMap = $objectVersion->attribute('data_map');
     $editionAttribute = $dataMap['newsletter_edition'];
     $editionAttributeContent = $editionAttribute->attribute('content');
     $listAttributeContent = $editionAttributeContent->attribute('list_attribute_content');
     $outputFormatArray = $listAttributeContent->attribute('output_format_array');
     $mainSiteAccess = $listAttributeContent->attribute('main_siteaccess');
     $skinName = $listAttributeContent->attribute('skin_name');
     $editionContentObjectId = $objectVersion->attribute('contentobject_id');
     $versionId = $objectVersion->attribute('version');
     $emailSender = $listAttributeContent->attribute('email_sender');
     $emailSenderName = $listAttributeContent->attribute('email_sender_name');
     $emailReplyTo = $listAttributeContent->attribute('email_reply_to');
     $emailReturnPath = $listAttributeContent->attribute('email_return_path');
     foreach ($outputFormatArray as $outputFormatId => $outputName) {
         $newsletterContentArray = CjwNewsletterEdition::getOutput($editionContentObjectId, $versionId, $outputFormatId, $mainSiteAccess, $skinName, $forceSettingImageIncludeTo);
         $newsletterContentArray['email_sender'] = $emailSender;
         $newsletterContentArray['email_sender_name'] = $emailSenderName;
         $newsletterContentArray['email_reply_to'] = $emailReplyTo;
         $newsletterContentArray['email_return_path'] = $emailReturnPath;
         $outputFormatTextArray[$outputName] = $newsletterContentArray;
     }
     return $outputFormatTextArray;
 }
Пример #4
0
 /**
  * (non-PHPdoc)
  * @see library/Oara/Network/Oara_Network_Publisher_Interface#getTransactionList($aMerchantIds, $dStartDate, $dEndDate, $sTransactionStatus)
  */
 public function getTransactionList($merchantList = null, Zend_Date $dStartDate = null, Zend_Date $dEndDate = null, $merchantMap = null)
 {
     $totalTransactions = array();
     $urls = array();
     $exportParams = array(new Oara_Curl_Parameter('agentcode', $this->_credentials['user']), new Oara_Curl_Parameter('pword', $this->_credentials['password']), new Oara_Curl_Parameter('fromdate', $dStartDate->toString("dd-MM-yyyy")), new Oara_Curl_Parameter('todate', $dEndDate->toString("dd-MM-yyyy")), new Oara_Curl_Parameter('rqtype', "report"));
     $urls[] = new Oara_Curl_Request('https://www.parkandgo.co.uk/agents/', $exportParams);
     $exportReport = $this->_client->post($urls);
     $today = new Zend_Date();
     $today->setHour(0);
     $today->setMinute(0);
     $exportData = str_getcsv($exportReport[0], "\n");
     $num = count($exportData);
     for ($i = 1; $i < $num; $i++) {
         $transactionExportArray = str_getcsv($exportData[$i], ",");
         $arrivalDate = new Zend_Date($transactionExportArray[3], 'yyyy-MM-dd 00:00:00', 'en');
         $transaction = array();
         $transaction['merchantId'] = 1;
         $transaction['unique_id'] = $transactionExportArray[0];
         $transactionDate = new Zend_Date($transactionExportArray[2], 'yyyy-MM-dd 00:00:00', 'en');
         $transaction['date'] = $transactionDate->toString("yyyy-MM-dd HH:mm:ss");
         unset($transactionDate);
         $transaction['status'] = Oara_Utilities::STATUS_PENDING;
         if ($today > $arrivalDate) {
             $transaction['status'] = Oara_Utilities::STATUS_CONFIRMED;
         }
         $transaction['amount'] = Oara_Utilities::parseDouble($transactionExportArray[6]);
         $transaction['commission'] = Oara_Utilities::parseDouble($transactionExportArray[7]);
         $totalTransactions[] = $transaction;
     }
     return $totalTransactions;
 }
Пример #5
0
 /**
  * Creates customer points transfers
  *
  * @param unknown_type $customer
  * @param unknown_type $like_id
  * @param unknown_type $rule
  * @return unknown
  */
 public function createFacebookLikePoints($customer, $like_id, $rule)
 {
     $num_points = $rule->getPointsAmount();
     $currency_id = $rule->getPointsCurrencyId();
     $rule_id = $rule->getId();
     $transfer = $this->initTransfer($num_points, $currency_id, $rule_id);
     $store = $customer->getStore();
     if (!$transfer) {
         return false;
     }
     //get On-Hold initial status override
     if ($rule->getOnholdDuration() > 0) {
         $transfer->setEffectiveStart(date('Y-m-d H:i:s', strtotime("+{$rule->getOnholdDuration()} days")))->setStatus(null, TBT_Rewards_Model_Transfer_Status::STATUS_PENDING_TIME);
     } else {
         //get the default starting status
         $initial_status = Mage::getStoreConfig('rewards/InitialTransferStatus/AfterFacebookLike', $store);
         if (!$transfer->setStatus(null, $initial_status)) {
             return false;
         }
     }
     // Translate the message through the core translation engine (nto the store view system) in case people want to use that instead
     // This is not normal, but we found that a lot of people preferred to use the standard translation system insteaed of the
     // store view system so this lets them use both.
     $initial_transfer_msg = Mage::getStoreConfig('rewards/transferComments/facebookLike', $store);
     $comments = Mage::helper('rewards')->__($initial_transfer_msg);
     $this->setFacebookLikeId($like_id)->setComments($comments)->setCustomerId($customer->getId())->save();
     return true;
 }
 /**
  * Notify Event Handler
  *
  * @param 	unknown_type $event
  * @access 	public
  */
 function notify($event)
 {
     if ($event->get('source')) {
         $s = owa_coreAPI::entityFactory('base.source_dim');
         $new_id = $s->generateId(trim(strtolower($event->get('source'))));
         $s->getByPk('id', $new_id);
         $id = $s->get('id');
         if (!$id) {
             $s->set('id', $new_id);
             $s->set('source_domain', $event->get('source'));
             $ret = $s->create();
             if ($ret) {
                 return OWA_EHS_EVENT_HANDLED;
             } else {
                 return OWA_EHS_EVENT_FAILED;
             }
         } else {
             owa_coreAPI::debug('Not Persisting. Source already exists.');
             return OWA_EHS_EVENT_HANDLED;
         }
     } else {
         owa_coreAPI::debug('Noting to handle. No source properties found on event.');
         return OWA_EHS_EVENT_HANDLED;
     }
 }
Пример #7
0
 /**
  *
  * 过滤器
  * @param unknown_type $filterChain
  */
 public function filterCheckAdmin($filterChain)
 {
     //未登录,跳转
     if (!($uid = $this->isAdmin())) {
         $this->redirect(Yii::app()->baseUrl . "/");
     }
     //获取用户详细资料
     $adminModel = new AdminModel();
     $this->_userInfo = $adminModel->getInfoByUid($uid);
     $this->username = $this->_userInfo['username'];
     $this->hospital = $this->_userInfo['hospital'];
     $this->role = $this->_userInfo['role'];
     //账号错误
     if (!$this->_userInfo) {
         $this->_output("302", 'access deny', 'text');
     }
     $roleModel = new RoleModel();
     $role = $roleModel->getInfoByCode($this->_userInfo['role']);
     if ($role && $role['permission']) {
         $permission = explode(',', $role['permission']);
         //生成菜单
         $menuModel = new MenuModel();
         $this->menus = $menuModel->getInfoByGroup($permission);
         foreach ($this->menus as $key => $value) {
             $this->menuGroup[$value['group']] = $value['group'];
         }
     } else {
         header("HTTP/1.1 401");
         exit;
     }
     $filterChain->run();
 }
Пример #8
0
 /**
  * @deprecated unused
  * Enter description here ...
  * @param unknown_type $observer
  */
 public function payForShippingWithPoints($observer)
 {
     $this->setRequest($observer->getControllerAction()->getRequest());
     $pay_for_shipping_with_points = $this->getRequest()->getParam('pay_for_shipping_with_points', '');
     if ($pay_for_shipping_with_points) {
         $quote = Mage::getSingleton('rewards/session')->getQuote();
         $shipaddr = $quote->getShippingAddress();
         $total_shipping_value = $shipaddr->getShippingAmount();
         $current_points_spending = Mage::getSingleton('rewards/session')->getPointsSpending();
         Mage::log("Paying for shipping with points...");
         $rule_ids = explode(',', $quote->getAppliedRedemptions());
         foreach ($rule_ids as $rid) {
             $salesrule = Mage::helper('rewards/transfer')->getSalesRule($rid);
             if ($salesrule->getPointsAction() != 'discount_by_points_spent') {
                 continue;
             }
             if (!$salesrule->getDiscountAmount()) {
                 continue;
             }
             // discount amount should not be empty (so we dont divide by zero)
             Mage::log("Points step according to quote is {$quote->getPointsStep()}");
             if ($salesrule->getPointsAmount() == $quote->getPointsStep()) {
                 $uses_to_zero_shipping = ceil($total_shipping_value / $salesrule->getDiscountAmount());
                 Mage::getSingleton('rewards/session')->setPointsSpending($uses_to_zero_shipping + $current_points_spending);
                 Mage::log("Added {$uses_to_zero_shipping} to existing points uage of {$current_points_spending}");
                 break;
             }
         }
     }
     return $this;
 }
Пример #9
0
 /**
  * Notify Event Handler
  *
  * @param 	unknown_type $event
  * @access 	public
  */
 function notify($event)
 {
     if ($event->get('ad')) {
         $d = owa_coreAPI::entityFactory('base.ad_dim');
         $new_id = $d->generateId(trim(strtolower($event->get('ad'))));
         $d->getByPk('id', $new_id);
         $id = $d->get('id');
         if (!$id) {
             $d->set('id', $new_id);
             $d->set('name', trim(strtolower($event->get('ad'))));
             $d->set('type', trim(strtolower($event->get('ad_type'))));
             $ret = $d->create();
             if ($ret) {
                 return OWA_EHS_EVENT_HANDLED;
             } else {
                 return OWA_EHS_EVENT_FAILED;
             }
         } else {
             owa_coreAPI::debug('Not Persisting. Ad already exists.');
             return OWA_EHS_EVENT_HANDLED;
         }
     } else {
         owa_coreAPI::debug('Noting to handle. No Ad properties found on event.');
         return OWA_EHS_EVENT_HANDLED;
     }
 }
Пример #10
0
/**
 * 
 * Enter description here ...
 * @param unknown_type $db
 * @param array $bp start ende chr ens_species 
 */
function getSyntenyRegionIDs($db, $bp)
{
    $species = strtolower($bp[3]);
    if ($species == 'mus_musculus') {
        $genome_db_id = 57;
    } elseif ($species == 'rattus_norvegicus') {
        $genome_db_id = 3;
    } elseif ($species == 'homo_sapiens') {
        $genome_db_id = 90;
    }
    $sqlDnafrag = 'SELECT dfr.synteny_region_id FROM dnafrag_region as dfr INNER JOIN 
	dnafrag as df ON (dfr.dnafrag_start <= ' . $bp[1] . ' AND 
	dfr.dnafrag_end >= ' . $bp[0] . ' AND 
	dfr.dnafrag_id = df.dnafrag_id AND 
	df.name = "' . $bp[2] . '" AND 
	df.genome_db_id = ' . $genome_db_id . ');';
    $fragQuery = $db->query($sqlDnafrag) or fatal_error('Query failed: ' . $db->error);
    //$frag_table = $fragQuery->fetch_all();
    $str = "";
    $first = true;
    while ($row = $fragQuery->fetch_assoc()) {
        if ($first) {
            $str .= $row['synteny_region_id'];
            $first = false;
        } else {
            $str .= "," . $row['synteny_region_id'];
        }
    }
    $fragQuery->close();
    return $str;
}
 /**
  * 添加一个lesson
  * @param unknown_type $lesson
  */
 public function addLesson($lesson)
 {
     $owner = $this->getOwner();
     $lesson->userId = Yii::app()->user->id;
     $lesson->courseId = $owner->id;
     $lesson->addTime = time();
     //处理外链类型的视频
     if ($lesson->mediaSource && $lesson->mediaSource != "self" && $lesson->mediaSource != "cloud" && $lesson->mediaType != "text") {
         if (strpos($lesson->mediaUri, 'http://') !== 0) {
             $lesson->mediaUri = 'http://' . $lesson->mediaUri;
         }
         if (strpos($lesson->mediaUri, '.swf') === false) {
             Yii::import('ext.videolink.VideoLink');
             $video = new VideoLink();
             $result = $video->parse($lesson->mediaUri);
             if ($result) {
                 $lesson->mediaUri = $result['swf'];
                 $lesson->mediaSource = $result['source'];
                 $lesson->mediaName = $result['title'];
                 $lesson->mediaType = "video";
             }
         }
     }
     if (!$lesson->title) {
         $lesson->title = $lesson->mediaName;
     }
     $lesson->status = Lesson::STATUS_HIDDEN;
     return $lesson->save();
 }
 /**
  * Notify Event Handler
  *
  * @param 	unknown_type $event
  * @access 	public
  */
 function notify($event)
 {
     $terms = trim(strtolower($event->get('search_terms')));
     if ($terms) {
         $st = owa_coreAPI::entityFactory('base.search_term_dim');
         $st_id = owa_lib::setStringGuid($terms);
         $st->getByPk('id', $st_id);
         $id = $st->get('id');
         if (!$id) {
             $st->set('id', $st_id);
             $st->set('terms', $terms);
             $ret = str_replace("", "", $terms, $count);
             $st->set('term_count', $count);
             $ret = $st->create();
             if ($ret) {
                 return OWA_EHS_EVENT_HANDLED;
             } else {
                 return OWA_EHS_EVENT_FAILED;
             }
         } else {
             owa_coreAPI::debug('Not Logging. Search term already exists.');
             return OWA_EHS_EVENT_HANDLED;
         }
     } else {
         return OWA_EHS_EVENT_HANDLED;
     }
 }
Пример #13
0
 /**
  * (non-PHPdoc)
  * @see library/Oara/Network/Oara_Network_Publisher_Interface#getTransactionList($aMerchantIds, $dStartDate, $dEndDate, $sTransactionStatus)
  */
 public function getTransactionList($merchantList = null, Zend_Date $dStartDate = null, Zend_Date $dEndDate = null, $merchantMap = null)
 {
     $totalTransactions = array();
     $urls = array();
     $url = "http://www.foxtransfer.eu/index.php?q=prices.en.html&page=affiliate_orders&language=1&basedir=theme2&what=record_time&what=record_time&fy={$dStartDate->toString("yyyy")}&fm={$dStartDate->toString("M")}&fd={$dStartDate->toString("d")}&ty={$dEndDate->toString("yyyy")}&tm={$dEndDate->toString("M")}&td={$dEndDate->toString("d")}";
     $urls[] = new Oara_Curl_Request($url, array());
     $exportReport = array();
     $exportReport = $this->_client->get($urls);
     $exportReport = str_replace("<?xml version=\"1.0\" encoding=\"UTF-8\"?>", "", $exportReport);
     $dom = new Zend_Dom_Query($exportReport[0]);
     $tableList = $dom->query('#tartalom-hatter table[cellspacing="0"][cellpadding="3"][border="0"]');
     $exportData = self::htmlToCsv(self::DOMinnerHTML($tableList->current()));
     $num = count($exportData);
     for ($i = 3; $i < $num; $i++) {
         $transactionExportArray = str_getcsv($exportData[$i], ";");
         $transaction = array();
         $transaction['merchantId'] = 1;
         $transaction['unique_id'] = $transactionExportArray[0];
         $transaction['date'] = "{$dStartDate->toString("yyyy")}-{$dStartDate->toString("MM")}-01 00:00:00";
         if ($transactionExportArray[7] == "Confirmed") {
             $transaction['status'] = Oara_Utilities::STATUS_CONFIRMED;
         } else {
             if ($transactionExportArray[7] == "Cancelled") {
                 $transaction['status'] = Oara_Utilities::STATUS_DECLINED;
             } else {
                 throw new Exception("New status found");
             }
         }
         $transaction['amount'] = Oara_Utilities::parseDouble(preg_replace("/[^0-9\\.,]/", "", $transactionExportArray[10]));
         $transaction['commission'] = Oara_Utilities::parseDouble(preg_replace("/[^0-9\\.,]/", "", $transactionExportArray[13]));
         $totalTransactions[] = $transaction;
     }
     return $totalTransactions;
 }
Пример #14
0
 /**
  * Return real shipped qty for an item
  * Welcome in magento.....
  *
  * @param unknown_type $item
  */
 public function getRealShippedQtyForItem($item)
 {
     //init vars
     $qty = $item->getQty();
     $orderItem = $item->getOrderItem();
     $orderItemParentId = $orderItem->getparent_item_id();
     //define if we have to multiply qty by parent qty
     $mustMultiplyByParentQty = false;
     if ($orderItemParentId > 0) {
         $parentOrderItem = mage::getmodel('sales/order_item')->load($orderItemParentId);
         if ($parentOrderItem->getId()) {
             //if shipped together
             if ($parentOrderItem->getproduct_type() == 'bundle' && !$parentOrderItem->isShipSeparately()) {
                 $mustMultiplyByParentQty = true;
                 $qty = $orderItem->getqty_ordered() / $parentOrderItem->getqty_ordered();
             }
         }
     }
     //if multiply by parent qty
     if ($mustMultiplyByParentQty) {
         $parentShipmentItem = null;
         foreach ($item->getShipment()->getAllItems() as $ShipmentItem) {
             if ($ShipmentItem->getorder_item_id() == $orderItemParentId) {
                 $parentShipmentItem = $ShipmentItem;
             }
         }
         if ($parentShipmentItem) {
             $qty = $qty * $parentShipmentItem->getQty();
         }
     }
     return $qty;
 }
Пример #15
0
 /**
  * Override?
  *
  * @param unknown_type $observer
  */
 public function initControllerRouters($observer)
 {
     $front = $observer->getEvent()->getFront();
     /** @var Mage_Core_Controller_Varien_Front $front * */
     $rewards = new TBT_Rewards_Controller_Router();
     //$front->addRouter('rewards', $rewards);
 }
Пример #16
0
 /**
  * Return object type
  *
  * @param unknown_type $object
  */
 public function getObjectType($object)
 {
     $retour = '';
     $resourceName = $object->getResourceName();
     $resourceName = strtolower($resourceName);
     return strtolower($resourceName);
 }
Пример #17
0
 /**
  * (non-PHPdoc)
  * @see library/Oara/Network/Oara_Network_Publisher_Interface#getTransactionList($aMerchantIds, $dStartDate, $dEndDate, $sTransactionStatus)
  */
 public function getTransactionList($merchantList = null, Zend_Date $dStartDate = null, Zend_Date $dEndDate = null, $merchantMap = null)
 {
     $totalTransactions = array();
     $valuesFromExport = array();
     $valuesFromExport[] = new Oara_Curl_Parameter('FromDate', $dStartDate->toString("dd/MM/yyyy"));
     $valuesFromExport[] = new Oara_Curl_Parameter('ToDate', $dEndDate->toString("dd/MM/yyyy"));
     $valuesFromExport[] = new Oara_Curl_Parameter('ReportType', 'dailyReport');
     $valuesFromExport[] = new Oara_Curl_Parameter('Link', '-1');
     $urls = array();
     $urls[] = new Oara_Curl_Request('https://www.bet365affiliates.com/Members/Members/Statistics/Print.aspx?', $valuesFromExport);
     $exportReport = $this->_client->get($urls);
     $dom = new Zend_Dom_Query($exportReport[0]);
     $tableList = $dom->query('#Results');
     if (!preg_match("/No results exist/", $exportReport[0])) {
         $exportData = self::htmlToCsv(self::DOMinnerHTML($tableList->current()));
         $num = count($exportData);
         for ($i = 2; $i < $num - 1; $i++) {
             $transactionExportArray = str_getcsv($exportData[$i], ";");
             $transaction = array();
             $transaction['merchantId'] = 1;
             $transactionDate = new Zend_Date($transactionExportArray[1], 'dd-MM-yyyy', 'en');
             $transaction['date'] = $transactionDate->toString("yyyy-MM-dd HH:mm:ss");
             $transaction['status'] = Oara_Utilities::STATUS_CONFIRMED;
             $transaction['amount'] = Oara_Utilities::parseDouble($transactionExportArray[27]);
             $transaction['commission'] = Oara_Utilities::parseDouble($transactionExportArray[32]);
             if ($transaction['amount'] != 0 && $transaction['commission'] != 0) {
                 $totalTransactions[] = $transaction;
             }
         }
     }
     return $totalTransactions;
 }
 /**
  * Notify Event Handler
  *
  * @param 	unknown_type $event
  * @access 	public
  */
 function notify($event)
 {
     $v = owa_coreAPI::entityFactory('base.visitor');
     $v->load($event->get('visitor_id'));
     if (!$v->wasPersisted()) {
         $v->setProperties($event->getProperties());
         // Set Primary Key
         $v->set('id', $event->get('visitor_id'));
         $v->set('first_session_id', $event->get('session_id'));
         $v->set('first_session_year', $event->get('year'));
         $v->set('first_session_month', $event->get('month'));
         $v->set('first_session_day', $event->get('day'));
         $v->set('first_session_dayofyear', $event->get('dayofyear'));
         $v->set('first_session_timestamp', $event->get('timestamp'));
         $ret = $v->create();
         if ($ret) {
             return OWA_EHS_EVENT_HANDLED;
         } else {
             return OWA_EHS_EVENT_FAILED;
         }
     } else {
         owa_coreAPI::debug("Not persisting. Visitor already exists.");
         return OWA_EHS_EVENT_HANDLED;
     }
 }
Пример #19
0
/**
 * @author Ignacio Vazquez - elpepe.uy at gmail.com
 * @param unknown_type $object
 * @param unknown_type $ignored
 */
function core_dimensions_after_update($object, &$ignored)
{
    static $objectsProcessed = array();
    if ($object instanceof Contact && !array_var($objectsProcessed, $object->getId())) {
        $person_dim = Dimensions::findOne(array("conditions" => "`code` = 'feng_persons'"));
        $person_ot = ObjectTypes::findOne(array("conditions" => "`name` = 'person'"));
        $company_ot = ObjectTypes::findOne(array("conditions" => "`name` = 'company'"));
        $members = Members::findByObjectId($object->getId(), $person_dim->getId());
        if (count($members) == 1) {
            /* @var $member Member */
            $member = $members[0];
            $member->setName($object->getObjectName());
            $parent_member_id = $member->getParentMemberId();
            $depth = $member->getDepth();
            if ($object->getCompanyId() > 0) {
                $pmember = Members::findOne(array('conditions' => '`object_id` = ' . $object->getCompanyId() . ' AND `object_type_id` = ' . $company_ot->getId() . ' AND `dimension_id` = ' . $person_dim->getId()));
                $member->setParentMemberId($pmember->getId());
                $member->setDepth($pmember->getDepth() + 1);
            } else {
                //Is first level
                $member->setDepth(1);
                $member->setParentMemberId(0);
            }
            $object->modifyMemberValidations($member);
            $member->save();
            // reload only if not disabling or enabling user
            if (!(array_var($_REQUEST, 'c') == 'account' && (array_var($_REQUEST, 'a') == 'disable' || array_var($_REQUEST, 'a') == 'restore_user'))) {
                evt_add("reload dimension tree", $member->getDimensionId());
            }
            $objectsProcessed[$object->getId()] = true;
        }
    }
}
 /**
  * test the modify method, which invokes the operation in template parsing mode
  * The operator "simplify("\n")" will replace the two more consecutive "\n" into one
  * @see tests/tests/lib/eztemplate/ezpTestCase#testModifySimplify()
  */
 public function testModifySimplifyWithParam()
 {
     $testString = "for Germany           on the whole, resultin\n\n\n\nKohl and Fra  nçois\nMitterrand we   re the jo";
     $expectedString = "for Germany           on the whole, resultin\nKohl and Fra  nçois\nMitterrand we   re the jo";
     $namedParameters = array("char" => "\n");
     $this->templateStringOperator->modify(null, "simplify", null, null, null, $testString, $namedParameters, null);
     $this->assertEquals($testString, $expectedString);
 }
Пример #21
0
/**
 * Records new events to the activity stream.
 * @param unknown_type $result
 * @param unknown_type $EM_Event
 * @return unknown
 */
function bp_em_record_activity_event_save($result, $EM_Event)
{
    if ($result && $EM_Event->status == 1 && ($EM_Event->previous_status == 0 || !empty($EM_Event->is_new))) {
        $user = get_userdata($EM_Event->owner);
        bp_em_record_activity(array('user_id' => $user->ID, 'action' => sprintf(__('%s added a the event %s', 'dbem'), "<a href='" . get_bloginfo('wpurl') . '/' . BP_MEMBERS_SLUG . '/' . $user->user_login . "/'>" . $user->display_name . "</a>", $EM_Event->output('#_EVENTLINK')), 'primary_link' => $EM_Event->output('#_EVENTURL'), 'type' => 'new_event', 'item_id' => $EM_Event->id));
    }
    return $result;
}
Пример #22
0
 /**
  * Bootstrap listener
  *
  * @see \Zend\ModuleManager\FeatureBootstrapListenerInterface::onBootstrap()
  * @param unknown_type $e
  */
 public function onBootstrap($e)
 {
     // You may not need to do this if you're doing it elsewhere in your
     // application
     $eventManager = $e->getApplication()->getEventManager();
     $moduleRouteListener = new ModuleRouteListener();
     $moduleRouteListener->attach($eventManager);
 }
Пример #23
0
 /**
  * hydrate yiidactivities objects from the extracted collection and return an array
  *
  * @author Christian Schätzle
  * @param unknown_type $pCollection
  * @return array(SocialObject)
  */
 private static function hydrateMongoCollectionToObjects($pCollection)
 {
     $lObjects = array();
     while ($pCollection->hasNext()) {
         $lObjects[] = self::initializeObjectFromCollection($pCollection->getNext());
     }
     return $lObjects;
 }
 public static function set($dataId, $dataValue)
 {
     if ($this->generalDataFile == NULL) {
         $this->generalDataFile = new KalturaTestConfig(dirname(__FILE__) . DIRECTORY_SEPARATOR . "generalData.ini");
     }
     $this->generalDataFile->{$dataId} = $dataValue;
     $this->generalDataFile->saveToIni();
 }
Пример #25
0
 public function overviewAction()
 {
     $this->view->assign('posts', $this->postRepository->findAll());
     $this->view->assign('comments', $this->commentRepository->findAll());
     //categories
     $this->view->assign('allCategories', $this->categoryRepository->findAll());
     $this->view->assign('rootCategorie', $this->settings['category']['root']);
 }
 /**
  * Notify Event Handler
  *
  * @param 	unknown_type $event
  * @access 	public
  */
 function notify($event)
 {
     if ($event->get('is_new_session')) {
         return $this->logSession($event);
     } else {
         return $this->logSessionUpdate($event);
     }
 }
Пример #27
0
 /**
  * Add rule to filter
  *
  *
  * @param unknown_type $rule
  */
 public function addRuleToFilter($rule)
 {
     if ($rule instanceof Mage_SalesRule_Model_Rule) {
         $ruleId = $rule->getId();
     } else {
         $ruleId = (int) $rule;
     }
     $this->addFieldToFilter('rule_id', $ruleId);
 }
 /**
  * Return mailbox view URL
  *
  * @return string
  */
 function getMailboxViewUrl()
 {
     $mailbox = $this->getMailbox();
     if (instance_of($mailbox, 'IncomingMailbox')) {
         return $this->mailbox->getViewUrl();
     }
     // if
     return lang('Unknown');
 }
Пример #29
0
/**
 * Загружает в переменную список блоков
 *
 * @param unknown_type $params
 * @param unknown_type $smarty
 * @return unknown
 */
function smarty_function_get_blocks($params, &$smarty)
{
    if (!array_key_exists('assign', $params)) {
        trigger_error("get_blocks: missing 'assign' parameter", E_USER_WARNING);
        return;
    }
    $smarty->assign($params['assign'], Engine::getInstance()->Viewer_GetBlocks());
    return '';
}
Пример #30
0
 /**
  * Helper function for rendering a resource inside this container
  * 
  * @param unknown_type $resource
  * @access protected
  */
 protected function render($resource)
 {
     $html = "<{$this->htmlElement}";
     foreach ($this->attributes as $k => $v) {
         $html .= " {$k}=\"{$v}\"";
     }
     $html .= " puny=\"{$resource->getId()}\">" . "{$resource->parse()->getContent()}" . "</{$this->htmlElement}>";
     return $html;
 }