static function importData($data, $labels, $rows, $global, $type, $options)
 {
     if ($type == self::EMAIL) {
         $mapping = $labels['email'];
     } else {
         if ($type == self::MOBILE) {
             $mapping = $labels['mobile'];
         }
     }
     //add new entries
     if ($options == self::ADD) {
         foreach ($rows as $rowIndex) {
             //add new from new data
             $value = $data[$mapping][$rowIndex];
             //echo "Adding: ".$value." ".$type." ".$global."<br>";
             eZRobinsonListEntry::create($value, $type, $global);
         }
     } else {
         if ($options == self::SYNC) {
             $new_values = array();
             foreach ($rows as $rowIndex) {
                 $new_values = array_merge($new_values, $data[$mapping][$rowIndex]);
             }
             foreach ($new_values as $value) {
                 //add new from new data
                 //echo "Sync Adding: ".$value." ".$type." ".$global."<br>";
                 eZRobinsonListEntry::create($value, $type, $global);
             }
             //get all current data
             $old_values = eZRobinsonListEntry::fetchValues($type, $global);
             foreach ($old_values as $value) {
                 if (!in_array($value, $new_values)) {
                     //remove from database
                     //echo "Sync Removing: ".$value." ".$type." ".$global."<br>";
                     eZRobinsonListEntry::removeByValue($value, $type, $global);
                 }
             }
         }
     }
     //echo "<br>";
 }
Exemplo n.º 2
0
                         $done = true;
                     }
                 }
             }
         } else {
             $warning = ezpI18n::tr('eznewsletter/robinson_user', 'Please enter a valid email.');
             $done = true;
         }
     }
 }
 if ($http->hasPostVariable('RobinsonlistEntry_Mobile')) {
     if ($http->postVariable('RobinsonlistEntry_Mobile') != "") {
         $empty_input = false;
         if ($http->hasPostVariable('AddButton')) {
             if (!eZRobinsonListEntry::inList($http->postVariable('RobinsonlistEntry_Mobile'), eZRobinsonListEntry::MOBILE)) {
                 eZRobinsonListEntry::create($http->postVariable('RobinsonlistEntry_Mobile'), eZRobinsonListEntry::MOBILE, eZRobinsonListEntry::IMPORT_LOCAL);
                 $done = true;
             } else {
                 $warning = ezpI18n::tr('eznewsletter/robinson_user', 'Entered mobile phone number is already in the list.');
                 $done = true;
             }
         } else {
             if ($http->hasPostVariable('RemoveButton')) {
                 if (eZRobinsonListEntry::inList($http->postVariable('RobinsonlistEntry_Mobile'), eZRobinsonListEntry::MOBILE, eZRobinsonListEntry::IMPORT_LOCAL)) {
                     eZRobinsonListEntry::removeByValue($http->postVariable('RobinsonlistEntry_Mobile'), eZRobinsonListEntry::MOBILE, eZRobinsonListEntry::IMPORT_LOCAL);
                     $done = true;
                 } else {
                     $warning = ezpI18n::tr('eznewsletter/robinson_user', 'Entered mobile phone number is not in the list.');
                     $done = true;
                 }
             }
Exemplo n.º 3
0
        foreach ($http->postVariable('MobileIDArray') as $id) {
            eZRobinsonListEntry::removeById($id);
        }
    }
}
$statusFilterArray = explode(',', $statusFilter);
$userParameters = $Params['UserParameters'];
//$statusFilter = isset( $userParameters['statusFilter'] ) ? explode( ',', $userParameters['statusFilter'] ) : array( -1 );
//$vipFilter = isset( $userParameters['vipFilter'] ) ? explode( ',', $userParameters['vipFilter'] ) : array( -1 );
$offset = isset($userParameters['offset']) ? $userParameters['offset'] : 0;
//$limitKey = isset( $userParameters['limit'] ) ? $userParameters['limit'] : '1';
$limitList = array('1' => 10, '2' => 25, '3' => 50);
$limit = $limitList[(string) $limitKey];
$viewParameters = array('offset' => $offset);
if ($http->hasPostVariable('CreateRobinsonlistEntryButton')) {
    $robinsonlistEntry = eZRobinsonListEntry::create();
    return $Module->redirectToView('robinson_edit', array($robinsonlistEntry->attribute('id')));
}
$condArray = array();
if (!in_array(-1, $statusFilterArray)) {
    $condArray['global'] = array($statusFilterArray);
}
$robinsonlist_Email = eZRobinsonListEntry::fetchByOffset(eZRobinsonListEntry::EMAIL, $condArray, $offset, $limit);
$robinsonlist_Mobile = eZRobinsonListEntry::fetchByOffset(eZRobinsonListEntry::MOBILE, $condArray, $offset, $limit);
$tpl = eZNewsletterTemplateWrapper::templateInit();
$tpl->setVariable('view_parameters', $viewParameters);
$tpl->setVariable('statusFilter', $statusFilterArray);
$tpl->setVariable('limit', $limit);
$tpl->setVariable('robinsonlist_Email', $robinsonlist_Email);
$tpl->setVariable('robinsonlist_Mobile', $robinsonlist_Mobile);
$tpl->setVariable('status_map', eZRobinsonListEntry::globalNameMap());