Esempio n. 1
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);
     }
 }
Esempio n. 2
0
 protected function save($memberId, $data)
 {
     $memberId = (int) $memberId;
     parent::save($memberId, $data);
     $columns = array();
     $keys = array_keys($this->_fields);
     foreach ($data as $col_key => $col_value) {
         if (in_array($col_key, $keys)) {
             $columns[$this->_fields[$col_key]] = $col_value;
         }
     }
     if (!$this->findMembers(array('member_id' => $memberId))) {
         $columns['NP_GenericProfileMemberID'] = $memberId;
         $this->_db->insert($this->_table, $columns);
     } else {
         $where = $this->_db->quoteInto('NP_GenericProfileMemberID = ?', $memberId);
         $this->_db->update($this->_table, $columns, $where);
     }
 }
Esempio n. 3
0
 public function toExcelAction()
 {
     $this->filename = 'Profil.xlsx';
     //        $this->type = 'Excel5';
     //        $this->type = 'CSV';
     $searchfor = $this->_request->getParam('searchfor');
     $profile = new GenericProfile();
     $this->select = $profile->getSelectStatement();
     $this->tables = array('GenericProfiles' => array('GP_LastName', 'GP_FirstName', 'GP_Email'));
     $this->fields = array('lastName' => array('width' => '', 'label' => ''), 'firstName' => array('width' => '', 'label' => ''), 'email' => array('width' => '', 'label' => ''));
     $this->filters = array();
     parent::toExcelAction();
 }
Esempio n. 4
0
 public function getViewersList($type = null)
 {
     $data = array();
     $log = array();
     $log[0] = array('notLogged' => 0);
     $select = parent::getAll(null, false);
     $select->order('L_Datetime ASC');
     if ($type != 'sendTo') {
         if (null !== $type) {
             $select->where('L_Action = ?', $type);
         }
         if ($this->_articleId > 0) {
             $select->where("L_Data like ?", '%articleId|' . $this->_articleId . '||%');
         }
         if ($this->_categoryId > 0) {
             $select->where("L_Data like ?", '%category|' . $this->_categoryId . '||%');
         }
         if ($this->_releaseId > 0) {
             $select->where("L_Data like ?", 'releaseID|' . $this->_releaseId . '%');
         }
         $select = $this->_addDateFilter($select);
         $data = $this->_db->fetchAll($select);
     } else {
         $data = $this->getRecipients();
     }
     $oUser = new GenericProfile();
     $prevValue = 1;
     $val = 1;
     foreach ($data as $record) {
         $prevValue = 1;
         if (!empty($record['L_UserID'])) {
             $user = $oUser->getMemberDetails($record['L_UserID']);
             if (!empty($log[$record['L_UserID']]['count'])) {
                 $prevValue = ++$log[$record['L_UserID']]['count'];
             }
             $log[$record['L_UserID']] = array('firstName' => $user['firstName'], 'lastName' => $user['lastName'], 'L_Datetime' => $record['L_Datetime'], 'email' => $user['email'], 'count' => $prevValue);
         } else {
             if (!empty($log[0]['notLogged'])) {
                 $val = ++$log[0]['notLogged'];
             }
             $log[0] = array('notLogged' => $val);
         }
     }
     ksort($log);
     return $log;
 }
Esempio n. 5
0
 public function unsubscribeAction()
 {
     $blockID = $this->_getParam('BlockID');
     $this->view->assign('messageConfidentialite', $this->view->getCibleText('joindre_fo_form_label_confident_joindre'));
     $newsletterID = $this->_getParam('newsletterID');
     $back_to_newsletter = !empty($newsletterID) ? "/ID/{$newsletterID}" : '';
     $blockParams = Cible_FunctionsBlocks::getBlockParameters($blockID)->toArray();
     $newsletterCategoryID = $blockParams[0]['P_Value'];
     $newsletterCategoryDetails = Cible_FunctionsCategories::getCategoryDetails($newsletterCategoryID);
     $this->view->assign('newsletterTitle', $newsletterCategoryDetails['CI_Title']);
     $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);
     $form = new FormNewsletterUnsubscription(array());
     $this->view->assign('form', $form);
     if ($this->_request->isPost()) {
         $formData = $this->_request->getPost();
         if ($form->isValid($formData)) {
             $message = str_replace('###newsletter_title_release###', " <b>{$newsletterCategoryDetails['CI_Title']}</b>", $this->view->getCibleText('newsletter_unsubscribe_confirmation_message'));
             $this->view->assign('message', $message);
             $this->view->assign('unsubscribeValidate', true);
             $genericProfil = new GenericProfile();
             $members = $genericProfil->findMembers(array('email' => $formData['email']));
             if (count($members) != 0) {
                 $memberID = $members[0]['member_id'];
                 $newsletterProfile = new NewsletterProfile();
                 $memberDetails = $newsletterProfile->getMemberDetails($memberID);
                 $memberNewsletterCategories = explode(',', $memberDetails['newsletter_categories']);
                 $i = 0;
                 foreach ($memberNewsletterCategories as $newsletterCategory) {
                     if ($newsletterCategory == $newsletterCategoryID) {
                         array_splice($memberNewsletterCategories, $i, 1);
                     } else {
                         $i++;
                     }
                 }
                 if (count($memberNewsletterCategories) == 0) {
                     $newsletterProfile->deleteMember($memberID);
                 } else {
                     $newMemberNewsletterCategories = implode(',', $memberNewsletterCategories);
                     $newsletterProfile->updateMember($memberID, array('newsletter_categories' => $newMemberNewsletterCategories));
                 }
                 if (empty($newsletterID)) {
                     $newsletterID = 0;
                 }
                 $this->_params = array('memberId' => $memberID, 'releaseId' => $newsletterID, 'category' => $newsletterCategoryID, 'reason' => $formData);
                 $this->logUnsubscribe();
             }
         }
     }
 }
Esempio n. 6
0
 public function userExistsAction()
 {
     $email = $this->_getParam('GP_Email');
     $id = $this->_getParam('id');
     $isValid = true;
     $oGenericProfile = new GenericProfile();
     $profiles = $oGenericProfile->findMembers(array('email' => $email));
     foreach ($profiles as $key => $profile) {
         if ($profile['member_id'] == $id) {
             unset($profiles[$key]);
             break;
         }
     }
     if (count($profiles) > 0) {
         $isValid = false;
     }
     if (!$id && !$isValid) {
         $editLink = $this->view->baseUrl() . "/" . $this->_moduleTitle . "/" . $this->_name . "/" . $this->_currentAction . "/" . "actionKey/edit/" . $this->_ID . "/" . $profiles[0]['member_id'];
         return $editLink;
     }
     if ($this->_isXmlHttpRequest) {
         $this->_helper->layout()->disableLayout();
         $this->_helper->viewRenderer->setNoRender(true);
         echo json_encode($isValid);
     }
 }