Ejemplo n.º 1
0
 public function setMemberProfile($member, $name, $value)
 {
     $profile = Doctrine::getTable('Profile')->retrieveByName($name);
     if (!$profile) {
         return null;
     }
     $memberProfile = new MemberProfile();
     $memberProfile->setMemberId($member->id);
     $memberProfile->setProfileId($profile->id);
     $memberProfile->setValue($value);
     $memberProfile->save();
 }
 public function save($memberId)
 {
     $values = $this->getValues();
     foreach ($values as $key => $value) {
         $profile = Doctrine::getTable('Profile')->retrieveByName($key);
         if (!$profile) {
             continue;
         }
         $memberProfile = Doctrine::getTable('MemberProfile')->retrieveByMemberIdAndProfileId($memberId, $profile->getId());
         if (is_null($value['value'])) {
             if ($memberProfile) {
                 if ($profile->isMultipleSelect()) {
                     $memberProfile->clearChildren();
                 }
                 $memberProfile->delete();
             }
             continue;
         }
         if (!$memberProfile) {
             $memberProfile = new MemberProfile();
             $memberProfile->setMemberId($memberId);
             $memberProfile->setProfileId($profile->getId());
         }
         $memberProfile->setPublicFlag($memberProfile->getProfile()->getDefaultPublicFlag());
         if (isset($value['public_flag'])) {
             $memberProfile->setPublicFlag($value['public_flag']);
         }
         $memberProfile->save();
         if ($profile->isMultipleSelect()) {
             $ids = array();
             $_values = array();
             if ('date' === $profile->getFormType()) {
                 $_values = array_map('intval', explode('-', $value['value']));
                 $options = $profile->getProfileOption();
                 foreach ($options as $option) {
                     $ids[] = $option->getId();
                 }
                 $memberProfile->setValue($value['value']);
             } else {
                 $ids = $value['value'];
             }
             Doctrine::getTable('MemberProfile')->createChild($memberProfile, $memberId, $profile->getId(), $ids, $_values);
         } else {
             $memberProfile->setValue($value['value']);
         }
         $memberProfile->save();
     }
     return true;
 }
Ejemplo n.º 3
0
 public function selectOneAction()
 {
     $authentication = Cible_FunctionsGeneral::getAuthentication();
     if ($authentication) {
         $profile = new MemberProfile();
         $memberInfos = $profile->findMember(array('email' => $authentication['email']));
         $data = array('city' => $memberInfos['cityId'], 'country' => $memberInfos['country'], 'state' => $memberInfos['state']);
         $this->view->assign('selectedState', $data['state']);
         $this->view->assign('selectedCity', $data['city']);
     }
     $form = new FormRetailersSelectOne();
     $this->view->assign('form', $form);
     if ($this->_request->isPost()) {
     } else {
         $form->populate($data);
     }
     $list = '';
     $this->view->assign('list', $list);
 }
Ejemplo n.º 4
0
 public function listClientsAction()
 {
     // web page title
     $this->view->title = "Clients";
     if ($this->view->aclIsAllowed($this->_moduleTitle, 'edit', true)) {
         $profile = new GenericProfile();
         $member = new MemberProfile();
         $oRetailer = new RetailersObject();
         $selectRetailer = $oRetailer->getAll(null, false);
         $selectRetailer->joinRight($profile->getGenericTable(), 'R_GenericProfileId = GP_MemberID', array('lastName' => 'GP_LastName', 'firstName' => 'GP_FirstName', 'email' => 'GP_Email'));
         $select = $selectRetailer->joinRight($member->getTable(), 'GP_MemberID = MP_GenericProfileMemberID', array('member_id' => 'MP_GenericProfileMemberID', 'company' => 'MP_CompanyName', 'MP_Status' => 'MP_Status'));
         $tables = array('GenericProfiles' => array('GP_LastName', 'GP_FirstName', 'GP_Email'), 'RetailersData' => array('R_ID', 'R_GenericProfileID', 'R_AddressId', 'R_Status'));
         $field_list = array('company' => array('width' => '250px'), 'lastName' => array('width' => '250px'), 'firstName' => array('width' => '250px'));
         $tables = array('GenericProfiles' => array('GP_lastName', 'GP_firstName'), 'MemberProfiles' => array('MP_CompanyName'));
         $this->view->params = $this->_getAllParams();
         $pageID = $this->_getParam('pageID');
         $langId = $this->_registry->languageID;
         $options = array('commands' => array($this->view->link($this->view->url(array('module' => 'profile', 'controller' => 'index', 'action' => 'add', 'returnModule' => $this->_moduleTitle, 'returnAction' => 'list-clients')), $this->view->getCibleText('button_add_profile'), array('class' => 'action_submit add'))), 'excludedColums' => array('Nom'), 'disable-export-to-excel' => '', 'to-excel-action' => 'clients-to-excel', 'filters' => array('filter_1' => array('label' => 'Liste des détaillants', 'default_value' => null, 'associatedTo' => 'GP_MemberID', 'equalTo' => 'R_GenericProfileId', 'choices' => array('' => 'Liste des détaillants', '1' => "--> Affichés sur le site")), 'filter_2' => array('label' => 'Liste des détaillants', 'default_value' => null, 'associatedTo' => 'MP_Status', 'choices' => array('' => 'Filtrer par statut', '-1' => 'Désactivé', '0' => 'Email non validé', '1' => 'À valider', '2' => 'Activé'))), 'action_panel' => array('width' => '50', 'actions' => array('edit' => array('label' => $this->view->getCibleText('menu_submenu_action_edit'), 'url' => $this->view->url(array('module' => 'profile', 'action' => 'edit', 'ID' => "-ID-", 'returnModule' => $this->_moduleTitle, 'returnAction' => 'list-clients')), 'findReplace' => array('search' => '-ID-', 'replace' => 'member_id')), 'delete' => array('label' => $this->view->getCibleText('menu_submenu_action_delete'), 'url' => $this->view->url(array('module' => 'profile', 'action' => 'delete', 'ID' => "-ID-", 'returnModule' => $this->_moduleTitle, 'returnAction' => 'list-clients')), 'findReplace' => array('search' => '-ID-', 'replace' => 'member_id')))));
         $mylist = new Cible_Paginator($select, $tables, $field_list, $options);
         $this->view->assign('mylist', $mylist);
     }
 }
Ejemplo n.º 5
0
 public function save($memberId)
 {
     $values = $this->getValues();
     foreach ($values as $key => $value) {
         $profile = Doctrine::getTable('Profile')->retrieveByName($key);
         if (!$profile) {
             continue;
         }
         $memberProfile = Doctrine::getTable('MemberProfile')->retrieveByMemberIdAndProfileId($memberId, $profile->getId());
         if (!$memberProfile) {
             $memberProfile = new MemberProfile();
             $memberProfile->setMemberId($memberId);
             $memberProfile->setProfileId($profile->getId());
         }
         $memberProfile->setPublicFlag($memberProfile->getProfile()->getDefaultPublicFlag());
         if (isset($value['public_flag'])) {
             $memberProfile->setPublicFlag($value['public_flag']);
         }
         $memberProfile->save();
         if ($profile->isMultipleSelect()) {
             $children = $memberProfile->getNode()->getChildren();
             if (count($children) < count($value['value'])) {
                 $n = count($value['value']) - count($children);
                 for ($i = 0; $i < $n; ++$i) {
                     $childProfile = new MemberProfile();
                     $childProfile->setMemberId($memberId);
                     $childProfile->setProfileId($profile->getId());
                     $childProfile->getNode()->insertAsLastChildOf($memberProfile);
                     $childProfile->save();
                 }
             }
             $children = $memberProfile->getNode()->getChildren();
             if ('date' === $profile->getFormType()) {
                 foreach ($children as $child) {
                     $child->setValue(null);
                     $child->save();
                 }
                 $_values = array_map('intval', explode('-', $value['value']));
                 $options = $profile->getProfileOption();
                 foreach ($_values as $i => $value) {
                     $children[$i]->setValue($value);
                     $children[$i]->save();
                 }
             } else {
                 foreach ($children as $child) {
                     $child->setProfileOptionId(null);
                     $child->save();
                 }
                 foreach ($value['value'] as $i => $v) {
                     $children[$i]->setProfileOptionId($v);
                     $children[$i]->save();
                 }
             }
         } else {
             $memberProfile->setValue($value['value']);
         }
         $children = $memberProfile->getNode()->getChildren();
         foreach ($children as $child) {
             if ('' === $child->_get('value') && is_null($child->get('profile_option_id'))) {
                 $child->getNode()->delete();
             }
         }
         $memberProfile->save();
     }
     return true;
 }
Ejemplo n.º 6
0
 public function createChild(Doctrine_Record $parent, $memberId, $profileId, $optionIds, $values = array())
 {
     $parent->clearChildren();
     foreach ($optionIds as $i => $optionId) {
         $childProfile = new MemberProfile();
         $childProfile->setMemberId($memberId);
         $childProfile->setProfileId($profileId);
         $childProfile->setProfileOptionId($optionId);
         if (isset($values[$i])) {
             $childProfile->setValue($values[$i]);
         }
         $childProfile->getNode()->insertAsLastChildOf($parent);
         $childProfile->save();
     }
 }
Ejemplo n.º 7
0
 public function actionUpdateInformation($id)
 {
     $modelMember = Members::model()->findByPk($id);
     $model = MemberProfile::model()->find('pr_member_id=' . intval($id));
     $result = false;
     if (isset($_POST['Members'])) {
         $modelMember->attributes = $_POST['Members'];
         $result = $modelMember->save();
     }
     if (isset($_POST['MemberProfile'])) {
         $model->attributes = $_POST['MemberProfile'];
         $result = $model->save();
     }
     if ($result) {
         $this->redirect(array('view', 'id' => $id));
     }
     $this->render('_form_update_information', array('model' => $model, 'modelMember' => $modelMember));
 }
Ejemplo n.º 8
0
 public function deleteAction()
 {
     /*         * ********************************* */
     // variables
     $memberID = $this->_request->getParam('ID');
     $baseDir = $this->view->baseUrl();
     $returnModule = $this->_request->getParam('returnModule');
     $returnAction = $this->_request->getParam('returnAction');
     if ($returnModule != '' && $returnAction != '') {
         $cancelUrl = $this->view->url(array('module' => $returnModule, 'action' => $returnAction, 'ID' => null, 'returnModule' => null, 'returnAction' => null));
     } else {
         $cancelUrl = $this->view->url(array('action' => 'list'));
     }
     $genericProfil = new GenericProfile();
     $memberProfil = new MemberProfile();
     $memberData = $memberProfil->getMemberDetails($memberID);
     $genericMemberDetails = $genericProfil->getMemberDetails($memberID);
     $this->view->assign('genericMemberDetails', $genericMemberDetails);
     if ($this->_request->isPost()) {
         $del = $this->_request->getPost('delete');
         if ($del) {
             $profile = new GenericProfile();
             $profile->deleteMember($memberID);
             //                $retailer = new RetailersObject();
             //                $retailer->deleteMember($memberID);
             //                $address  = new AddressObject();
             //                $address->delete($memberData['addrBill']);
             //                $address->delete($memberData['addrShip']);
             if ($returnModule != '' && $returnAction != '') {
                 $cancelUrl = $this->view->url(array('module' => $returnModule, 'action' => $returnAction, 'returnModule' => null, 'returnAction' => null, 'order' => 'lastName', 'order-direction' => 'ASC', 'page' => null));
             } else {
                 $cancelUrl = $this->view->url(array('action' => 'list', 'returnModule' => null, 'returnAction' => null, 'order' => 'lastName', 'order-direction' => 'ASC', 'page' => null));
             }
         }
         $this->_redirect(str_replace($baseDir, '', $cancelUrl));
     }
 }
Ejemplo n.º 9
0
 /**
  * Controller action to manage the details of the cart.
  * Update/delete items or load the list.
  *
  * @return void
  */
 public function cartdetailsAction()
 {
     $account = Cible_FunctionsGeneral::getAuthentication();
     if (!$account) {
         $this->_redirect(Cible_FunctionsPages::getPageNameByID(1, Zend_Registry::get('languageID')));
     }
     $productData = array();
     $cart = new Cart();
     if ($this->_isXmlHttpRequest) {
         $this->disableLayout();
         $this->disableView();
         $action = $this->_getParam('do');
         $productId = $this->_getParam('pId');
         $itemId = $this->_getParam('itemId');
         $quantity = $this->_getParam('quantity');
         $size = $this->_getParam('size');
         $category = $this->_getParam('category');
         $disable = $this->_getParam('disable');
         $cartId = $this->_getParam('cartItemsId');
         if ($action == 'update' && !empty($productId)) {
             if (!empty($size)) {
                 $cart->updateItem($productId, -1, array('CI_TailleID' => $size, 'CI_ItemID' => $itemId, 'CI_CartItemsID' => $cartId));
             } elseif (!empty($category)) {
                 $cart->updateItem($productId, -1, array('CI_CatTailleID' => $category, 'CI_ItemID' => $itemId, 'CI_CartItemsID' => $cartId));
             } else {
                 $oItem = new ItemsObject();
                 $oItem->setId($itemId);
                 $amount = $oItem->getPrice($quantity);
                 $cart->updateItem($productId, $quantity, array('CI_ItemID' => $itemId, 'CI_Total' => $amount, 'CI_CartItemsID' => $cartId));
             }
             echo 'updated';
         } elseif ($action == 'delete' && !empty($productId)) {
             if ($itemId && $cartId) {
                 $cart->updateItem($productId, 0, array('CI_ItemID' => $itemId, 'CI_CartItemsID' => $cartId));
                 echo 'deletedRow';
             } else {
                 $cart->updateItem($productId);
                 echo 'deleted';
             }
         } elseif ($action == 'disable' && !empty($productId)) {
             $cart->updateItem($productId, -1, array('CI_IsToSend' => $disable, 'CI_ItemID' => $itemId));
         } elseif ($action == 'addSize' && !empty($productId)) {
             $lastId = $cart->addSize(array('CI_ID' => $productId, 'CI_Quantity' => 1, 'CI_CatTailleID' => $category, 'CI_ItemID' => $itemId));
         } elseif ($action == 'getSizes' && !empty($category)) {
             $oSize = new TailleObject();
             $langId = $this->_getParam('langId');
             $size = $oSize->getDataByCategoryTailleId($category, $langId);
             echo json_encode($size);
             exit;
         }
     } else {
         $url = $this->view->absolute_web_root . $this->getRequest()->getPathInfo();
         $exclude = preg_match('/resume-order/', $url);
         if (!$exclude) {
             Cible_View_Helper_LastVisited::saveThis($url);
         }
         $urlBack = '';
         $urlNextStep = '';
         $urls = Cible_View_Helper_LastVisited::getLastVisited();
         if (count($urls) > 1) {
             $urlBack = $urls[1];
         }
         $account = Cible_FunctionsGeneral::getAuthentication();
         $profile = new MemberProfile();
         $memberData = $profile->findMember(array('email' => $account['email']));
         $memberData = $profile->addTaxRate($memberData);
         //            if ($memberData['validatedEmail'] == '')
         //                $this->view->assign('valide', true);
         //            else
         //                $this->view->assign('valide', false);
         $cartData = $cart->getAllIds();
         $allIds = $cartData['cartId'];
         if (count($allIds)) {
             $urlNextStep = $this->view->baseUrl() . '/' . Cible_FunctionsPages::getPageNameByID($this->_orderPageId, Zend_Registry::get('languageID')) . '/auth-order/';
         }
         $this->view->assign('itemCount', count($allIds));
         $this->view->assign('cartTotal', $cart->getTotalItem());
         $oProduct = new ProductsCollection();
         //            $orderPageId = Cible_FunctionsCategories::getPagePerCategoryView(0, 'order', 17);
         $resume = false;
         if ($this->_registry->pageID == $this->_orderPageId) {
             $resume = true;
         }
         foreach ($allIds as $key => $id) {
             $itemId = $cartData['itemId'][$key];
             $prodId = $cartData['prodId'][$key];
             $productData[$id] = $oProduct->getDetails($prodId, $itemId, $resume);
             $cartDetails = $cart->getItem($id, $itemId);
             if ($resume) {
                 $renderItem = $cart->renderResume($cartDetails, $itemId);
             } else {
                 $renderItem = $cart->renderCartLine($cartDetails, $itemId);
             }
             $productData[$id]['items']['render'] = $renderItem;
             $productData[$id]['cart']['disable'] = $cartDetails['Disable'];
             $productData[$id]['cart']['promoId'] = $cartDetails['PromoId'];
         }
         $hasBonus = $oProduct->getBonus();
         $orderParams = Cible_FunctionsGeneral::getParameters();
         $parameters = array('nbPoint' => 0, 'taxeProv' => $memberData['taxProv'], 'taxeCode' => $memberData['taxCode'], 'tpsFee' => $orderParams['CP_ShippingFees'], 'limitTpsFee' => $orderParams['CP_ShippingFeesLimit'], 'CODFees' => $orderParams['CP_MontantFraisCOD'], 'noProvTax' => $memberData['noProvTax'], 'noFedTax' => $memberData['noFedTax']);
         if ($memberData['taxCode'] == 'QC') {
             $parameters['taxeFed'] = $orderParams['CP_TauxTaxeFed'];
         }
         if ($hasBonus) {
             $parameters['nbPoint'] = $orderParams['CP_BonusPointDollar'];
         }
         $this->view->assign('productData', $productData);
         $this->view->assign('urlBack', $urlBack);
         $this->view->assign('nextStep', $urlNextStep);
         $this->view->assign('step', 1);
         $this->view->assign('hasBonus', $oProduct->getBonus());
         $this->view->assign('parameters', $parameters);
         if ($this->_registry->pageID == $this->_orderPageId) {
             $this->renderScript('index/cart-summary.phtml');
         } else {
             $this->renderScript('index/cart-details.phtml');
         }
     }
 }
Ejemplo n.º 10
0
 /**
  * Retrieve the registred users with managers privileges.
  *
  * @return array
  */
 public static function getClientWithManagerPrivileges()
 {
     $db = Zend_Registry::get("db");
     $profile = new MemberProfile();
     $select = $profile->getSelectStatement();
     //        $select->where('MP_IsDetaillant = ?', 1);
     $select->order('company');
     $select->order('lastName');
     $select->order('firstName');
     return $db->fetchAll($select);
 }
  protected function execute($arguments = array(), $options = array())
  {
    $databaseManager = new sfDatabaseManager($this->configuration);
    $this->conn = $databaseManager->getDatabase('doctrine')->getDoctrineConnection();

    $sql = 'SELECT id FROM member WHERE is_active != 0';
    $where = array();
    if ( $options['min'] && $options['max']  && $options['min'] <= $options['max'])
    {
        $sql .= ' AND id BETWEEN ? AND ?';
        $where = array(intval($options['min']),intval($options['max']));
    }
    $memberIds = $this->conn->fetchColumn($sql, $where);

    // configを増やす
    if ($options['config'])
    {
      $configs = explode(',',$options['config']);
      foreach ($memberIds as $memberid)
      {
        $member = Doctrine::getTable('Member')->find($memberid);
        foreach ($configs as $config)
        {
          $member->setConfig($config, 'dummy');
          $this->logSection('member_config', sprintf("%s - %s", $config, $memberid));
        }
        $member->free();
      }
    }

    // profileを増やす
    if ($options['profile'])
    {
      $profiles = explode(',',$options['profile']);
      $preProfiles = Doctrine::getTable('Profile')->createQuery()
        ->select('id')
        ->execute(array(), Doctrine::HYDRATE_NONE);
      foreach ($preProfiles as $key => $value)
      {
        $profileid = $value[0];
        if (in_array($profileid, $profiles))
        {
          foreach ($memberIds as $memberid)
          {
            $sql = 'SELECT id FROM member_profile WHERE member_id = ? AND profile_id = ?';
            $where = array(intval($memberid), intval($profileid));
            $mp = $this->conn->fetchOne($sql, $where);
print "$mp";
            if (!$mp)
            {
              opApplicationConfiguration::registerZend();
              $memberProfile = new MemberProfile();
              $memberProfile->setMemberId($memberid);
              $memberProfile->setProfileId($profileid);
              $memberProfile->setValue('dummy');
              $memberProfile->save();
              $memberProfile->free();
              $this->logSection('member_profile', sprintf("%s - %s", $memberid, $profileid));
            } 
          }
        }
      }
    }

  }
Ejemplo n.º 12
0
 public function executeSaveAboutYourself(sfWebRequest $request)
 {
     try {
         $data = $request->getParameter('data');
         $data = json_decode($data);
         $member_id = $_SESSION['userId'];
         foreach ($data as $v) {
             $arrVal = (array) $v;
             $profile_choice_id = $arrVal['profile_choice_id'];
             $profile_id = $arrVal['profile_id'];
             $value = $arrVal['value'];
             $memProfile = new MemberProfile();
             $memProfile->savePersonalInformation($member_id, $profile_choice_id, $profile_id, $value);
         }
         die(json_encode(array('success' => true)));
     } catch (Exception $e) {
         die(json_encode(array('success' => false, 'error' => $e->getMessage())));
     }
 }
Ejemplo n.º 13
0
 public function importAction()
 {
     $form = new FormImportNewsletter(array('cancelUrl' => $this->view->baseUrl()));
     $this->view->assign('form', $form);
     if ($this->_request->isPost()) {
         $formData = $this->_request->getPost();
         if ($form->isValid($formData)) {
             if ($form->file->receive()) {
                 $file = fopen($form->file->getFileName(), "r") or die('no file were selected');
                 while (!feof($file)) {
                     $line = fgets($file);
                     list($salutation, $nom, $prenom, $courriel, $lang) = split(';', $line);
                     $newsletterProfile = new NewsletterProfile();
                     $memberId = $newsletterProfile->addMember(array('lastName' => $nom, 'firstName' => $prenom, 'salutation' => $salutation, 'email' => $courriel, 'language' => $lang, 'newsletter_categories' => '21'));
                     $memberProfile = new MemberProfile();
                     $memberProfile->updateMember($memberId, array('isMember' => 1));
                 }
                 fclose($file);
             }
         }
     }
 }
Ejemplo n.º 14
0
/* @var $model Members */
/*Kiểm tra quyền update*/
$canUpdate = false;
if (YII::app()->user->id == $model->pr_primary_key) {
    $canUpdate = true;
}
/*End Kiểm tra quyền update thông tin user */
$this->breadcrumbs = array('Pr Members' => array('index'), $model->pr_primary_key);
?>

<h3>Thông tin cá nhân</h3>
<div>
    <div style="width:140px;float: left;">
        <div >
          <?php 
echo CHtml::image(MemberProfile::model()->getProfileUrl($model->pr_primary_key), 'images_user', array('width' => '100', 'class' => 'images_circle', 'id' => 'member_images'));
?>
  
        </div>
        <br>
         <!-- ###Ajax thay đổi ảnh đại diện -->
        <?php 
if ($canUpdate) {
    $this->widget('ext.EAjaxUpload.EAjaxUpload', array('id' => 'uploadFile', 'config' => array('action' => $this->createUrl('uploadMember', array('id' => $model->memberProfile->pr_primary_key)), 'allowedExtensions' => array("jpg", "jpeg", "gif", "png"), 'sizeLimit' => 10 * 1024 * 1024, 'minSizeLimit' => 1 * 1024, 'onComplete' => "js:function(id, fileName, responseJSON){\n                                       \$('#member_images').attr('src','" . Yii::app()->getBaseUrl() . "/uploads/'+fileName);\n                                       \$('#uploadFile .qq-upload-list').html('');\n                                    }", 'messages' => array('typeError' => "{file} has invalid extension. Only {extensions} are allowed.", 'sizeError' => "{file} is too large, maximum file size is {sizeLimit}.", 'minSizeError' => "{file} is too small, minimum file size is {minSizeLimit}.", 'emptyError' => "{file} is empty, please select files again without it.", 'onLeave' => "The files are being uploaded, if you leave now the upload will be cancelled."), 'showMessage' => "js:function(message){ alert(message); }")));
}
?>
         <!-- End thay đổi ảnh đại diện -->
    </div>
    <div style="width: 990px;float: left;">
        <?php 
$this->widget('bootstrap.widgets.TbDetailView', array('data' => $model, 'attributes' => array(array('name' => 'Tài khoản', 'type' => 'raw', 'value' => $model->pr_username), array('name' => 'Họ tên', 'type' => 'raw', 'value' => $model->memberProfile->pr_member_profile_display_name), 'pr_member_email', array('name' => 'pr_roles_id', 'type' => 'raw', 'value' => Roles::model()->findByPk($model->pr_roles_id)->pr_roles_name), array('name' => 'Địa chỉ', 'type' => 'raw', 'value' => $model->memberProfile->pr_member_profile_address), array('name' => 'Số điện thoại', 'type' => 'raw', 'value' => $model->memberProfile->pr_member_profile_phone), array('name' => 'pr_member_active', 'type' => 'raw', 'value' => function ($data) {
 public function myprofile()
 {
     if (!MemberLogin::isLogged()) {
         MemberLogin::handleNotLogged();
     } else {
         MemberProfile::my();
     }
 }
Ejemplo n.º 16
0
 public function getProfileUrl($member_id = 0)
 {
     if ($member_id == 0) {
         $member_id = $this->pr_member_id;
     }
     $memberProfile = MemberProfile::model()->find('pr_member_id=' . intval($member_id));
     $images_url = Yii::app()->getBaseUrl() . $memberProfile->pr_member_profile_images;
     if (file_exists(Yii::getPathOfAlias('webroot') . $memberProfile->pr_member_profile_images)) {
         return $images_url;
     }
     return Yii::app()->getBaseUrl() . '/images/no-user.png';
 }
Ejemplo n.º 17
0
 public function detailsarticleAction()
 {
     //$this->view->jQuery()->addJavascriptFile($this->view->locateFile('jquery.prettyPhoto.js', 'jquery'));
     //$this->view->headLink()->appendStylesheet($this->view->locateFile('prettyPhoto.css'), 'screen');
     // Article ID and Newsletter ID
     $newsletterArticlesSelect = new NewsletterArticles();
     $id = 0;
     $newsletterID = 0;
     $url = $this->_request->getPathInfo();
     $fromEmail = (bool) preg_match('/-uid-[0-9]+/', $url);
     $user = Zend_Registry::get('user');
     $memberId = 0;
     $titleUrl = Cible_FunctionsGeneral::getTitleFromPath($url);
     if ($titleUrl != "") {
         $id = $newsletterArticlesSelect->getArticleIdByName($titleUrl);
         $newsletterID = $newsletterArticlesSelect->getNewsletterIdByName($titleUrl);
     }
     if ($fromEmail) {
         $pos = strpos($url, '-uid-');
         $uid = explode('-', substr($url, $pos));
         $memberId = end($uid);
         $url = substr_replace($url, '', $pos);
         $path = Zend_Registry::get('web_root') . '/';
         setcookie('uid_newsletter', (string) $memberId, 0, $path);
     } else {
         if (isset($_COOKIE['uid_newsletter'])) {
             $memberId = $_COOKIE['uid_newsletter'];
         }
     }
     if ($memberId == 0 && $user) {
         $oMember = new MemberProfile();
         $member = $oMember->findMember(array('email' => $user['email']));
         $memberId = $member['member_id'];
     }
     $back_to_newsletter = !empty($newsletterID) ? "/ID/{$newsletterID}" : '';
     $blockID = $this->_getParam('BlockID');
     $blockParams = Cible_FunctionsBlocks::getBlockParameters($blockID)->toArray();
     $newsletterCategoryID = $blockParams[0]['P_Value'];
     if (!empty($id)) {
         $this->_params = array('moduleId' => $this->_moduleID, 'releaseId' => $newsletterID, 'memberId' => $memberId, 'articleId' => $id);
         $this->logDetailsread();
         $newsletterSelect = new NewsletterReleases();
         $select = $newsletterSelect->select();
         $select->from('Newsletter_Releases')->where('NR_LanguageID = ?', Zend_Registry::get("languageID"))->where('NR_ID = ?', $newsletterID);
         $newsletterData = $newsletterSelect->fetchRow($select);
         $titleParution = $newsletterData['NR_Title'];
         $titleURLParution = $newsletterData['NR_ValUrl'];
         //var_dump($newsletterData);
         if ($newsletterData['NR_Online'] == 1) {
             // article info
             $select = $newsletterArticlesSelect->select();
             $select->where('NA_ID = ?', $id);
             //$select->where('NA_ReleaseID = ?', $newsletterID);
             $newsletterArticlesData = $newsletterArticlesSelect->fetchAll($select);
             if (count($newsletterArticlesData) < 0) {
                 $this->_redirect(Cible_FunctionsCategories::getPagePerCategoryView($newsletterCategoryID, 'details_release', 8));
             }
             $this->view->articles = $newsletterArticlesData->toArray();
             $blockID = $this->_getParam('BlockID');
             $blockParams = Cible_FunctionsBlocks::getBlockParameters($blockID)->toArray();
             $newsletterCategoryID = $blockParams[0]['P_Value'];
             $this->view->assign('parution_title', $titleParution);
             $this->view->assign('parution_date', $newsletterData['NR_Date']);
             $this->view->assign('subscribeLink', $this->view->baseUrl() . "/" . Cible_FunctionsCategories::getPagePerCategoryView($newsletterCategoryID, 'subscribe', 8));
             $this->view->assign('unsubscribeLink', $this->view->baseUrl() . "/" . Cible_FunctionsCategories::getPagePerCategoryView($newsletterCategoryID, 'unsubscribe', 8));
             $this->view->assign('parutionURL', $titleURLParution);
             $this->view->assign('back_to_release', Cible_FunctionsCategories::getPagePerCategoryView($newsletterCategoryID, 'details_release', 8));
             //$this->view->assign('back_to_release', $this->view->baseUrl()."/".Cible_FunctionsCategories::getPagePerCategoryView($newsletterCategoryID, 'details_release', 8) . $back_to_newsletter);
             $this->view->assign('archivesLink', $this->view->baseUrl() . "/" . Cible_FunctionsCategories::getPagePerCategoryView($newsletterCategoryID, 'list_archives', 8) . '/categoryID/' . $newsletterCategoryID);
         } else {
             $this->view->articles = array();
             $this->view->assign('parutionURL', $titleURLParution);
             $this->view->assign('subscribeLink', $this->view->baseUrl() . "/" . Cible_FunctionsCategories::getPagePerCategoryView($newsletterCategoryID, 'subscribe', 8));
             $this->view->assign('unsubscribeLink', $this->view->baseUrl() . "/" . Cible_FunctionsCategories::getPagePerCategoryView($newsletterCategoryID, 'unsubscribe', 8));
             $this->view->assign('back_to_release', $this->view->baseUrl() . "/" . Cible_FunctionsCategories::getPagePerCategoryView($newsletterCategoryID, 'details_release', 8) . $back_to_newsletter);
             $this->view->assign('archivesLink', $this->view->baseUrl() . "/" . Cible_FunctionsCategories::getPagePerCategoryView($newsletterCategoryID, 'list_archives', 8) . '/categoryID/' . $newsletterCategoryID);
         }
     } else {
         $this->view->assign('subscribeLink', $this->view->baseUrl() . "/" . Cible_FunctionsCategories::getPagePerCategoryView($newsletterCategoryID, 'subscribe', 8));
         $this->view->assign('unsubscribeLink', $this->view->baseUrl() . "/" . Cible_FunctionsCategories::getPagePerCategoryView($newsletterCategoryID, 'unsubscribe', 8));
         $this->view->assign('back_to_release', $this->view->baseUrl() . "/" . Cible_FunctionsCategories::getPagePerCategoryView($newsletterCategoryID, 'details_release', 8) . $back_to_newsletter);
         $this->view->assign('parutionURL', $titleURLParution);
         $this->view->assign('archivesLink', $this->view->baseUrl() . "/" . Cible_FunctionsCategories::getPagePerCategoryView($newsletterCategoryID, 'list_archives', 8) . '/categoryID/' . $newsletterCategoryID);
         $this->view->articles = array();
     }
 }
Ejemplo n.º 18
0
 private function _buildData($orderOnly = false)
 {
     $url = Cible_FunctionsCategories::getPagePerCategoryView(0, 'list_collections', 14);
     $this->view->headLink()->appendStylesheet($this->view->locateFile('cart.css'));
     $account = Cible_FunctionsGeneral::getAuthentication();
     if (!$account) {
         $this->_redirect($url);
     }
     $oMember = new MemberProfile();
     $user = $oMember->findMember($account);
     $orderId = $this->_getParam('qr');
     $oOrder = new OrderCollection();
     if ($orderId) {
         $oOrder->setOrderId($orderId);
     }
     $oOrder->setUserId($user['member_id']);
     $oOrder->setOrderOnly($orderOnly);
     $select = $oOrder->getData();
     return $select;
 }