Пример #1
0
	/**
	 * MakeViewPopupMenu
	 * Return "view" popup menus
	 *
	 * @param Array $search_info Search info
	 * @param User_API $user (REF) Current user record
	 * @return String Returns "View" popup menu HTML string
	 *
	 * @uses GetLang()
	 * @uses SendStudio_Functions::ParseTemplate()
	 */
	function MakeViewPopupMenu($search_info, &$user)
	{
		$tempCommonRows = array();
		$tempListRows = array();
		$tempSegmentRows = array();

		$tempSelectedListID = 0;
		$tempSelectedSegmentID = '-';
		$tempSelectedAllList = false;

		if (array_key_exists('List', $search_info)) {
			$tempSelectedListID = intval($search_info['List']);
		}

		if (array_key_exists('Segment', $search_info) && is_array($search_info['Segment'])) {
			$tempSelectedSegmentID = $search_info['Segment'];
		}

		$tempSelectedAllList = ($tempSelectedListID == 0 && $tempSelectedSegmentID == 0);

		/**
		 * List views
		 */
			if ($user->HasAccess('Lists') && !empty($search_info['List'])) {
				$tempListList = $user->GetLists();
				foreach ($tempListList as $tempListID => $tempListRecord) {
					$GLOBALS['RowAction'] = 'index.php?Page=Subscribers&Action=Manage&Lists[]=' . $tempListID;
					$GLOBALS['RowTitle'] = htmlspecialchars($tempListRecord['name'], ENT_QUOTES, SENDSTUDIO_CHARSET);
					$GLOBALS['RowCaption'] = '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<img border="0" src="images/nodejoinsmall.gif" />&nbsp;&nbsp;' . htmlspecialchars($this->TruncateName($tempListRecord['name'], 55), ENT_QUOTES, SENDSTUDIO_CHARSET);

					if ($tempSelectedListID == $tempListID) {
						$GLOBALS['RowCaption'] = '<b>' . $GLOBALS['RowCaption'] . '</b>';
					}

					array_push($tempListRows, $this->ParseTemplate('Subscribers_Manage_ViewPicker_Row', true));
				}
				unset($tempListList);
			} else {
				$GLOBALS['DisplayStyleList'] = 'none';
			}
		/**
		 * -----
		 */

		/**
		 * Segment views
		 */
			if ($user->HasAccess('Segments') && !empty($search_info['Segment'])) {
				$tempSegmentList = $user->GetSegmentList();
				if (count($tempSegmentList) == 0) {
					$GLOBALS['SegmentDisplay'] = 'none';
				} else {
					$GLOBALS['SegmentDisplay'] = '';

					foreach ($tempSegmentList as $tempSegmentID => $tempSegmentRecord) {
						$GLOBALS['RowAction'] = 'index.php?Page=Subscribers&Action=Manage&Segment=' . $tempSegmentID;
						$GLOBALS['RowTitle'] = htmlspecialchars($tempSegmentRecord['segmentname'], ENT_QUOTES, SENDSTUDIO_CHARSET);
						$GLOBALS['RowCaption'] = '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<img border="0" src="images/nodejoinsmall.gif" />&nbsp;&nbsp;' . htmlspecialchars($this->TruncateName($tempSegmentRecord['segmentname'], 55), ENT_QUOTES, SENDSTUDIO_CHARSET);

						if ($tempSelectedSegmentID == $tempSegmentID) {
							$GLOBALS['RowCaption'] = '<b>' . $GLOBALS['RowCaption'] . '</b>';
						}

						array_push($tempSegmentRows, $this->ParseTemplate('Subscribers_Manage_ViewPicker_Row', true));
					}
					unset($tempSegmentList);
				}
			} else {
				$GLOBALS['DisplayStyleSegment'] = 'none';
			}
		/**
		 * -----
		 */

		unset($GLOBALS['RowCaption']);
		unset($GLOBALS['RowTitle']);
		unset($GLOBALS['RowAction']);

		$GLOBALS['CommonViews'] = implode('', $tempCommonRows);
		$GLOBALS['ListViews'] = implode('', $tempListRows);
		$GLOBALS['SegmentViews'] = implode('', $tempSegmentRows);

		$output = $this->ParseTemplate('Subscribers_Manage_ViewPicker', true);

		unset($GLOBALS['SegmentViews']);
		unset($GLOBALS['ListViews']);
		unset($GLOBALS['CommonViews']);

		return $output;
	}