Bitrix Site Manager

CAdvBanner::GetList

record set
CAdvBanner::GetList(
 varchar &by,
 varchar &order,
 array arFilter = array(),
 boolean &is_filtered
);

The GetList method returns a list of banners.

Parameters

ParameterDescription
by Identifier specifying the name of the field that is to be used for sorting. This can be one of the following fields:
  • s_id - by ID;
  • s_lamp - by the indicator value;
  • s_name - by the banner name;
  • s_type_sid - by the banner type;
  • s_contract_id - by the banner ID;
  • s_group_sid - by the group name;
  • s_show_count - by the number of shows;
  • s_max_show_count - by the maximum number of shows;
  • s_date_last_show - by the date of the last show;
  • s_click_count - by the number of banner clicks;
  • s_max_click_count - by the maximum number of clicks;
  • s_date_last_click - by the date of the last click;
  • s_active - by the active state flag;
  • s_weight - by banner weight;
  • s_status_sid - by the banner status;
  • s_date_show_from - by the date of the first show;
  • s_date_show_to - by the date of the last show;
  • s_ctr - by the banner CTR.
order Sort order. The following values are possible:
  • desc - descending (default);
  • asc - ascending.
arFilter Optional additional filter by fields in the form of Array("Filtering field"=>"Value", ...). The Filtering field can be one of the following:
  • ID - banner ID (complex logics allowed)
  • ID_EXACT_MATCH - if set to "Y", banner ID's must match exactly. If set to "N", it can be an entry in the banner ID text.
  • LAMP - indicator value: "red", "green"
  • LANG - double-character language identifier. Denotes the site on which the required banners are shown;
  • SHOW_COUNT_1 - minimum shows;
  • SHOW_COUNT_2 - maximum shows;
  • CLICK_COUNT_1 - minimum clicks;
  • CLICK_COUNT_2 - maximum clicks;
  • CTR_1 - minimum CTR;
  • CTR_2 - maximum CTR;
  • GROUP - name of the banner group (complex logics allowed)
  • GROUP_EXACT_MATCH - if set to "Y", group name must match exactly; if set to "N", it can be an entry in the group name.
  • STATUS_SID - symbolic status code (complex logics allowed); can be one of the following :
    • PUBLISHED - a banner is approved and published;
    • READY - a banner is still on approval;
    • REJECTED - a banner is rejected.
  • CONTRACT_ID - contract ID (complex logics allowed)
  • CONTRACT_ID_EXACT_MATCH - if set to "Y", the contract ID must match exactly; if set to "N", it can be an entry in the contract ID.
  • CONTRACT - ID, name and description of the contract (complex logics allowed)
  • CONTRACT_EXACT_MATCH - if set to "Y", the contract ID, name or description must match exactly; if set to "N", it can be an entry in the contract ID, name or description.
  • TYPE_SID - symbolic code of a banner type (complex logics allowed)
  • TYPE_SID_EXACT_MATCH - if set to "Y", the symbolic code of a banner type must match exactly; if set to "N", it can be an entry in the symbolic code of a banner type.
  • NAME - banner name (complex logics allowed)
  • NAME_EXACT_MATCH - if set to "Y", the banner name must match exactly; if set to "N", it can be an entry in the banner name (default).
  • CODE - banner code (complex logics allowed)
  • CODE_EXACT_MATCH - if set to "Y", the banner code must match exactly; if set to "N", it can be an entry in the banner code (default).
  • COMMENTS - banner comment (complex logics allowed)
  • COMMENTS_EXACT_MATCH - if set to "Y", the banner comment must match exactly; if set to "N", it can be an entry in the banner comment text (default).
is_filtered Reference to a variable that contains true on the method return if a list of banners has been filtered, or false otherwise.

Return Value

The method returns an array containing the selected banners. See Example.

Example


<?
$FilterArr = Array(
    "find_id",
    "find_id_exact_match",
    "find_lamp",
    "find_lang",
    "find_show_count_1",
    "find_show_count_2",
    "find_click_count_1",
    "find_click_count_2",
    "find_ctr_1",
    "find_ctr_2",
    "find_contract_id",
    "find_contract",
    "find_contract_exact_match",
    "find_group",
    "find_group_exact_match",
    "find_status_sid",
    "find_type_sid",
    "find_type",
    "find_type_exact_match",
    "find_name",
    "find_name_exact_match",
    "find_code",
    "find_code_exact_match",
    "find_comments",
    "find_comments_exact_match"
    );

if (strlen($set_filter)>0)
    InitFilterEx($FilterArr,"ADV_BANNER_LIST","set"); 
else
    InitFilterEx($FilterArr,"ADV_BANNER_LIST","get");

if (strlen($del_filter)>0)
    DelFilterEx($FilterArr,"ADV_BANNER_LIST");

InitBVar($find_id_exact_match);
InitBVar($find_status_exact_match);
InitBVar($find_group_exact_match);
InitBVar($find_contract_exact_match);
InitBVar($find_type_exact_match);
InitBVar($find_name_exact_match);
InitBVar($find_code_exact_match);
InitBVar($find_comments_exact_match);

$arFilter = Array(
    "ID"                    => $find_id,
    "ID_EXACT_MATCH"        => $find_id_exact_match,
    "LAMP"                  => $find_lamp,
    "LANG"                  => $find_lang,
    "SHOW_COUNT_1"          => $find_show_count_1,
    "SHOW_COUNT_2"          => $find_show_count_2,
    "CLICK_COUNT_1"         => $find_click_count_1,
    "CLICK_COUNT_2"         => $find_click_count_2,
    "CTR_1"                 => $find_ctr_1,
    "CTR_2"                 => $find_ctr_2,
    "GROUP"                 => $find_group,
    "GROUP_EXACT_MATCH"     => $find_group_exact_match,
    "STATUS_SID"            => $find_status_sid,
    "CONTRACT_ID"           => $find_contract_id,
    "CONTRACT"              => $find_contract,
    "CONTRACT_EXACT_MATCH"  => $find_contract_exact_match,
    "TYPE_SID"              => $find_type_sid,
    "TYPE"                  => $find_type,
    "TYPE_EXACT_MATCH"      => $find_type_exact_match,
    "NAME"                  => $find_name,
    "NAME_EXACT_MATCH"      => $find_name_exact_match,
    "CODE"                  => $find_code,
    "CODE_EXACT_MATCH"      => $find_code_exact_match,
    "COMMENTS"              => $find_comments,
    "COMMENTS_EXACT_MATCH"  => $find_comments_exact_match
    );

$rsBanners = CAdvBanner::GetList($by, $order, $arFilter, $is_filtered);
$rsBanners->NavStart(20);
$rsBanners->NavPrint("Banners");

while($arBanner = $rsBanners->NavNext(true, "f_"))
{
    echo "<pre>"; print_r($arBanner); echo "</pre>";
}
?>

The following is an example of array returned by a call to the Fetch method of one of the returned objects:

<?
Array
(
    [LAMP] => green
    [ID] => 88
    [CONTRACT_ID] => 1
    [TYPE_SID] => TOP
    [GROUP_SID] => 
    [STATUS_SID] => PUBLISHED
    [STATUS_COMMENTS] =>
    [NAME] =>
    [ACTIVE] => Y
    [LID] => 
    [WEIGHT] => 100
    [MAX_SHOW_COUNT] => 300
    [MAX_CLICK_COUNT] => 100
    [SHOW_COUNT] => 102
    [CLICK_COUNT] => 4
    [IMAGE_ID] => 1032
    [IMAGE_ALT] =>
    [URL] => http://www.bitrixsoft.com?banner_param=#EVENT_GID#
    [URL_TARGET] => _parent
    [STAT_EVENT_1] => 
    [STAT_EVENT_2] => 
    [STAT_EVENT_3] => 
    [FOR_NEW_GUEST] => 
    [COMMENTS] => 
    [CREATED_BY] => 2
    [MODIFIED_BY] => 2
    [CTR] => 3.92
    [DATE_LAST_SHOW] => 24.06.2004 17:39:50
    [DATE_LAST_CLICK] => 24.06.2004 14:47:53
    [DATE_SHOW_FROM] => 10.06.2004
    [DATE_SHOW_TO] => 07.07.2007
    [DATE_CREATE] => 10.06.2004 11:25:59
    [DATE_MODIFY] => 24.06.2004 14:33:56
    [CONTRACT_NAME] => Default
    [TYPE_NAME] => Top banner
    [CODE_TYPE] => html
    [CODE] => <TABLE class=smalltext cellSpacing=0 cellPadding=0 width=145>
<TR>
<TD></TD>
<TD>
<DIV align=center>
<A class=righthead 
   href="/en/partners/partnership.php">partnership Program</A>
</DIV></TD></TR>
<TR>
<TD></TD>
<TD height=8></TD></TR>
<TR>
<TD width=5></TD>
<TD vAlign=bottom>
<DIV align=center>
<A href="/en/partners/partnership.php">
<IMG height=95 src="/images/advert/free.gif" 
     width=100 border=0></A></DIV></TD></TR>
<TR>
<TD></TD>
<TD height=5></TD></TR>
<TR>
<TD></TD>
<TD>Developers and integrators obtain:<BR>
<B><FONT class=smalltext>
<IMG height=8 src="/images/list_bullet.gif" width=8>
</FONT></B> 
<FONT color=#ff5a31>50% discounts</FONT> 
<BR><B><FONT class=smalltext>
<IMG height=8 src="/images/list_bullet.gif" width=8>
</FONT></B> 
<FONT color=#ff5a31>free license</FONT></TD></TR>
<TR>
<TD></TD>
<TD height=5></TD></TR>
<TR>
<TD></TD>
<TD>
<DIV align=right>
<A class=bottomlinks
 href="/en/partners/partnership.php">more info</A>
 <IMG height=7 src="/images/main_button_more_3.gif" width=7>
 </DIV></TD></TR></TABLE>
)
?>