Esempio n. 1
0
 function addDefaultCustomLists()
 {
     global $includeDumpJs;
     $v1 = ItemField::getFixOrCommonField('title');
     $v2 = ItemField::getFixOrCommonField('cName');
     $v3 = ItemField::getFixOrCommonField('creationtime');
     $v4 = ItemField::getFixOrCommonField('description');
     $v5 = ItemField::getFixOrCommonField('clicked');
     $v6 = ItemField::getFixOrCommonField('responded');
     $v7 = ItemField::getFixOrCommonField('ownerName');
     // Kivalasztjuk a common picture field-et, ha letezik:
     $fields = ItemField::getFixAndCommonFields();
     for ($pictureField = 0, $i = 0; !$pictureField && $i < count($fields); $pictureField = $fields[$i++]->type == customfield_picture ? $fields[$i - 1]->id : 0) {
     }
     $cl = new CustomList();
     $cl->listTitle = "Search result list";
     $cl->listDescription = "This is a special custom list you can use to configure the columns of a non-category specific search result list.";
     $cl->columns = "{$v1->id},{$v2->id},{$v4->id},{$v7->id}" . ($pictureField ? ",{$pictureField}" : "");
     $cl->create(TRUE);
     $cl = new CustomList();
     $cl->listTitle = "My ads";
     $cl->listDescription = "The list of ads of a user. This means both the 'My ads' list (the list of the currently logged in user), and the 'Advertisements of user XY' lists.";
     $cl->ownerName = array(0);
     $cl->primarySort = $v3->id;
     $cl->primaryDir = "DESC";
     $cl->columns = "{$v1->id},{$v2->id},{$v5->id},{$v6->id},{$v4->id}";
     $cl->displayedFor = customfield_forLoggedin;
     $cl->displayInMenu = customlist_userMenu;
     $cl->relationBetweenFields = search_allFields;
     $cl->create(TRUE);
     $cl = new CustomList();
     $cl->listTitle = "Recent ads";
     $cl->listDescription = "List of 100 most recent ads";
     $cl->status = array(1);
     $cl->primarySort = $v3->id;
     $cl->primaryDir = "DESC";
     $cl->limit = '100';
     $cl->columns = "{$v1->id},{$v2->id},{$v3->id},{$v4->id}" . ($pictureField ? ",{$pictureField}" : "");
     $cl->displayedFor = customfield_forAll;
     $cl->displayInMenu = customlist_loginMenu;
     $cl->create(TRUE);
     $cl = new CustomList();
     $cl->listTitle = "Popular ads";
     $cl->listDescription = "List of 100 most viewed ads";
     $cl->status = array(1);
     $cl->primarySort = $v5->id;
     $cl->primaryDir = "DESC";
     $cl->secondarySort = $v3->id;
     $cl->secondaryDir = "DESC";
     $cl->limit = '100';
     $cl->columns = "{$v1->id},{$v2->id},{$v5->id},{$v6->id},{$v4->id}" . ($pictureField ? ",{$pictureField}" : "");
     $cl->displayedFor = customfield_forAll;
     $cl->displayInMenu = customlist_loginMenu;
     $cl->create(TRUE);
     $cl = new CustomList();
     $cl->listTitle = "Pending ads";
     $cl->listDescription = "The list of ads that you haven't approved yet.";
     $cl->status = array(0);
     $cl->primarySort = $v3->id;
     $cl->primaryDir = "ASC";
     $cl->columns = "{$v1->id},{$v2->id},{$v3->id},{$v7->id},{$v4->id}";
     $cl->displayedFor = customfield_forAdmin;
     $cl->displayInMenu = customlist_adminMenu;
     $cl->create(TRUE);
     $cl = new CustomList();
     $cl->listTitle = "Featured ads: Gold level";
     $cl->listDescription = "This is a featured ad list that demonstrate a way you can set up the 'featured ads' feature yourself. It contains all the ads where the 'Promotion level' common custom field has been set to 'Gold'.";
     $cl->status = array(1);
     $cl->columns = "{$v1->id}" . ($pictureField ? ",{$pictureField}" : "") . ",{$v4->id}";
     foreach ($fields as $field) {
         if ($field->name == "Promotion level") {
             $cl->{$field->columnIndex} = array("Gold");
         }
     }
     $cl->displayedFor = customfield_forAdmin;
     $cl->listStyle = customlist_scrollable;
     $cl->positionScrollable = customlist_aboveContent;
     $cl->pages = $includeDumpJs ? "" : "/";
     $cl->limit = 10;
     $cl->relationBetweenFields = search_allFields;
     $cl->create(TRUE);
     // vegig kell menni a common fieldeken
     reset($fields);
     foreach ($fields as $field) {
         if (strstr($field->columnIndex, "col_")) {
             $field->updateDefaultOfSelectionTypeFieldOfCustomList();
         }
     }
 }