/**
  * Генерирует HTML для поля в списке
  * @see AdminListHelper::addRowCell();
  * @param CAdminListRow $row
  * @param array $data - данные текущей строки
  * @return mixed
  */
 public function genListHTML(&$row, $data)
 {
     if (isset($this->settings['EDIT_IN_LIST']) and $this->settings['EDIT_IN_LIST']) {
         $row->AddCalendarField($this->getCode());
     } else {
         $row->AddViewField($this->getCode(), $this->getValue());
     }
 }
 /**
  * Генерирует HTML для поля в списке
  * @see AdminListHelper::addRowCell();
  * @param CAdminListRow $row
  * @param array $data - данные текущей строки
  * @return mixed
  */
 public function genListHTML(&$row, $data)
 {
     $image = $this->getImageByID($data[$this->code], 'LIST');
     if (!$image) {
         $html = "";
     } else {
         $html = '<img src="' . $image['src'] . '" width="' . $this->getSettings('LIST_WIDTH') . '" height="' . $this->getSettings('LIST_HEIGHT') . '">';
     }
     $row->AddViewField($this->code, $html);
 }
 /**
  * Генерирует HTML для поля в списке
  * @see AdminListHelper::addRowCell();
  * @param CAdminListRow $row
  * @param array $data - данные текущей строки
  * @return mixed
  */
 public function genListHTML(&$row, $data)
 {
     $urlText = htmlspecialchars($data[$this->getCode()]);
     if (strlen($urlText) > $this->getSettings('MAX_URL_LEN')) {
         $urlText = substr($urlText, 0, $this->getSettings('MAX_URL_LEN'));
     }
     $href = '<a href="' . $data[$this->getCode()] . '" target="_blank">' . $urlText . '</a>';
     if ($this->getSettings('EDIT_IN_LIST') and !$this->getSettings('READONLY')) {
         $row->AddInputField($this->getCode(), ['style' => 'width:90%']);
     }
     $row->AddViewField($this->getCode(), $href);
 }
 /**
  * Генерирует HTML для поля в списке
  * @see AdminListHelper::addRowCell();
  * @param \CAdminListRow $row
  * @param array $data - данные текущей строки
  * @return mixed
  */
 public function genListHTML(&$row, $data)
 {
     $text = $data[$this->code];
     if (strlen($text) > self::LIST_TEXT_SIZE && !$this->isExcelView()) {
         $pos = false;
         $pos = $pos === false ? stripos($text, " ", self::LIST_TEXT_SIZE) : $pos;
         $pos = $pos === false ? stripos($text, "\n", self::LIST_TEXT_SIZE) : $pos;
         $pos = $pos === false ? stripos($text, "</", self::LIST_TEXT_SIZE) : $pos;
         $pos = $pos === false ? 300 : $pos;
         $text = substr($text, 0, $pos) . " ...";
     }
     $text = preg_replace('/<.+>/mU', '', $text);
     $row->AddViewField($this->code, $text);
 }
 /**
  * Генерирует HTML для поля в списке
  * @see AdminListHelper::addRowCell();
  * @param CAdminListRow $row
  * @param array $data - данные текущей строки
  * @return mixed
  */
 public function generateRow(&$row, $data)
 {
     if (isset($this->settings['EDIT_IN_LIST']) and $this->settings['EDIT_IN_LIST']) {
         $row->AddCalendarField($this->getCode());
     } else {
         $arDate = ParseDateTime($this->getValue());
         if ($arDate['YYYY'] < 10) {
             $stDate = '-';
         } else {
             $stDate = ConvertDateTime($this->getValue(), "DD.MM.YYYY HH:MI:SS", "ru");
         }
         $row->AddViewField($this->getCode(), $stDate);
     }
 }
Example #6
0
	/**
	 * @param $arUserField
	 * @param $value
	 * @param CAdminListRow $row
	 */
	function AddUserField($arUserField, $value, &$row)
	{
		if($arUserField["USER_TYPE"])
		{
			$js = $this->ShowScript();
			if(is_callable(array($arUserField["USER_TYPE"]["CLASS_NAME"], "getadminlistviewhtml")))
			{
				if($arUserField["MULTIPLE"] == "N")
				{
					$html = call_user_func_array(
						array($arUserField["USER_TYPE"]["CLASS_NAME"], "getadminlistviewhtml"),
						array(
							$arUserField,
							array(
								"NAME" => "FIELDS[".$row->id."][".$arUserField["FIELD_NAME"]."]",
								"VALUE" => htmlspecialcharsbx($value),
							),
						)
					);
					if($html == '')
						$html = '&nbsp;';
					$row->AddViewField($arUserField["FIELD_NAME"], $html.$js.CAdminCalendar::ShowScript());
				}
				elseif(is_callable(array($arUserField["USER_TYPE"]["CLASS_NAME"], "getadminlistviewhtmlmulty")))
				{
					if(is_array($value))
						$form_value = $value;
					else
						$form_value = unserialize($value);

					if(!is_array($form_value))
						$form_value = array();

					foreach($form_value as $key=>$val)
						$form_value[$key] = htmlspecialcharsbx($val);

					$html = call_user_func_array(
						array($arUserField["USER_TYPE"]["CLASS_NAME"], "getadminlistviewhtmlmulty"),
						array(
							$arUserField,
							array(
								"NAME" => "FIELDS[".$row->id."][".$arUserField["FIELD_NAME"]."]"."[]",
								"VALUE" => $form_value,
							),
						)
					);
					if($html == '')
						$html = '&nbsp;';
					$row->AddViewField($arUserField["FIELD_NAME"], $html.$js.CAdminCalendar::ShowScript());
				}
				else
				{
					$html = "";

					if(is_array($value))
						$form_value = $value;
					else
						$form_value = strlen($value) > 0? unserialize($value): false;

					if(!is_array($form_value))
						$form_value = array();

					foreach($form_value as $i=>$val)
					{
						if($html!="")
							$html .= " / ";
						$html .= call_user_func_array(
							array($arUserField["USER_TYPE"]["CLASS_NAME"], "getadminlistviewhtml"),
							array(
								$arUserField,
								array(
									"NAME" => "FIELDS[".$row->id."][".$arUserField["FIELD_NAME"]."]"."[".$i."]",
									"VALUE" => htmlspecialcharsbx($val),
								),
							)
						);
					}
					if($html == '')
						$html = '&nbsp;';
					$row->AddViewField($arUserField["FIELD_NAME"], $html.$js.CAdminCalendar::ShowScript());
				}
			}
			if($arUserField["EDIT_IN_LIST"]=="Y" && is_callable(array($arUserField["USER_TYPE"]["CLASS_NAME"], "getadminlistedithtml")))
			{
				if($arUserField["MULTIPLE"] == "N")
				{
					$html = call_user_func_array(
						array($arUserField["USER_TYPE"]["CLASS_NAME"], "getadminlistedithtml"),
						array(
							$arUserField,
							array(
								"NAME" => "FIELDS[".$row->id."][".$arUserField["FIELD_NAME"]."]",
								"VALUE" => htmlspecialcharsbx($value),
							),
						)
					);
					if($html == '')
						$html = '&nbsp;';
					$row->AddEditField($arUserField["FIELD_NAME"], $html.$js.CAdminCalendar::ShowScript());
				}
				elseif(is_callable(array($arUserField["USER_TYPE"]["CLASS_NAME"], "getadminlistedithtmlmulty")))
				{
					if(is_array($value))
						$form_value = $value;
					else
						$form_value = strlen($value) > 0? unserialize($value): false;

					if(!is_array($form_value))
						$form_value = array();

					foreach($form_value as $key=>$val)
						$form_value[$key] = htmlspecialcharsbx($val);

					$html = call_user_func_array(
						array($arUserField["USER_TYPE"]["CLASS_NAME"], "getadminlistedithtmlmulty"),
						array(
							$arUserField,
							array(
								"NAME" => "FIELDS[".$row->id."][".$arUserField["FIELD_NAME"]."][]",
								"VALUE" => $form_value,
							),
						)
					);
					if($html == '')
						$html = '&nbsp;';
					$row->AddEditField($arUserField["FIELD_NAME"], $html.$js.CAdminCalendar::ShowScript());
				}
				else
				{
					$html = "<table id=\"table_".$arUserField["FIELD_NAME"]."_".$row->id."\">";
					if(is_array($value))
						$form_value = $value;
					else
						$form_value = unserialize($value);

					if(!is_array($form_value))
						$form_value = array();

					$i = -1;
					foreach($form_value as $i=>$val)
					{
						$html .= '<tr><td>'.call_user_func_array(
							array($arUserField["USER_TYPE"]["CLASS_NAME"], "getadminlistedithtml"),
							array(
								$arUserField,
								array(
									"NAME" => "FIELDS[".$row->id."][".$arUserField["FIELD_NAME"]."]"."[".$i."]",
									"VALUE" => htmlspecialcharsbx($val),
								),
							)
						).'</td></tr>';
					}
					$html .= '<tr><td>'.call_user_func_array(
						array($arUserField["USER_TYPE"]["CLASS_NAME"], "getadminlistedithtml"),
						array(
							$arUserField,
							array(
								"NAME" => "FIELDS[".$row->id."][".$arUserField["FIELD_NAME"]."]"."[".($i+1)."]",
								"VALUE" => "",
							),
						)
					).'</td></tr>';
					$html .= '<tr><td><input type="button" value="'.GetMessage("USER_TYPE_PROP_ADD").'" onClick="addNewRow(\'table_'.$arUserField["FIELD_NAME"].'_'.$row->id.'\', /'.'FIELDS\['.$row->id.'\]\['.$arUserField["FIELD_NAME"].'\]'.'\[([0-9]*)\]/g, 1)"></td></tr>'.
					'</table>';
					$row->AddEditField($arUserField["FIELD_NAME"], $html.$js.CAdminCalendar::ShowScript());
				}
			}
		}
	}
 /**
  * Генерирует HTML для поля в списке
  * @see AdminListHelper::addRowCell();
  * @param CAdminListRow $row
  * @param array $data - данные текущей строки
  * @return mixed
  */
 public function genListHTML(&$row, $data)
 {
     if ($this->settings['EDIT_IN_LIST'] and !$this->settings['READONLY']) {
         $row->AddInputField($this->getCode(), ['style' => 'width:90%']);
     } else {
         $row->AddViewField($this->getCode(), $this->getValueReadonly());
     }
 }
 /**
  * Генерирует HTML для поля в списке
  * @see AdminListHelper::addRowCell();
  * @param \CAdminListRow $row
  * @param array $data - данные текущей строки
  * @return mixed
  */
 public function genListHTML(&$row, $data)
 {
     if ($this->getSettings('MULTIPLE')) {
     } else {
         $file = \CFile::GetPath($data[$this->code]);
         $res = \CFile::GetByID($data[$this->code]);
         $fileInfo = $res->Fetch();
         if (!$file) {
             $html = "";
         } else {
             $html = '<a href="' . $file . '" >' . $fileInfo['FILE_NAME'] . ' (' . $fileInfo['FILE_DESCRIPTION'] . ')' . '</a>';
         }
         $row->AddViewField($this->code, $html);
     }
 }
Example #9
0
 function CAdminSubListRow(&$aHeaders, $table_id)
 {
     parent::CAdminListRow($aHeaders, $table_id);
 }
 /**
  * Генерирует HTML для поля в списке
  * @see AdminListHelper::addRowCell();
  * @param \CAdminListRow $row
  * @param array $data - данные текущей строки
  */
 public function generateRow(&$row, $data)
 {
     if ($this->getSettings('MULTIPLE')) {
     } else {
         if ($this->getSettings('EDIT_LINK') || $this->getSettings('SECTION_LINK')) {
             $entityClass = $this->entityName;
             $pk = $entityClass::getEntity()->getPrimary();
             if ($this->getSettings('SECTION_LINK')) {
                 $params = $this->helper->isPopup() ? $_GET : array();
                 $params['ID'] = $this->data[$pk];
                 $listHelper = $this->helper->getHelperClass($this->helper->isPopup() ? AdminSectionListHelper::className() : AdminListHelper::className());
                 $pageUrl = $listHelper::getUrl($params);
                 $value = '<span class="adm-submenu-item-link-icon adm-list-table-icon iblock-section-icon"></span>';
             } else {
                 $editHelper = $this->helper->getHelperClass(AdminEditHelper::className());
                 $pageUrl = $editHelper::getUrl(array('ID' => $this->data[$pk]));
             }
             $value .= '<a href="' . $pageUrl . '">' . static::prepareToOutput($this->getValue()) . '</a>';
         } else {
             $value = static::prepareToOutput($this->getValue());
         }
         if ($this->getSettings('EDIT_IN_LIST') and !$this->getSettings('READONLY')) {
             $row->AddInputField($this->getCode(), array('style' => 'width:90%'));
         }
         $row->AddViewField($this->getCode(), $value);
     }
 }
 /**
  * Генерирует HTML для поля в списке
  * @see AdminListHelper::addRowCell();
  * @param \CAdminListRow $row
  * @param array $data - данные текущей строки
  */
 public function genListHTML(&$row, $data)
 {
     if ($this->getSettings('MULTIPLE')) {
     } else {
         if ($this->getSettings('EDIT_LINK')) {
             $entityClass = $this->entityName;
             $pk = $entityClass::getEntity()->getPrimary();
             $editPageUrl = $this->helper->getEditPageURL(['ID' => $this->data[$pk]]);
             $value = '<a href="' . $editPageUrl . '">' . $this->getValue() . '</a>';
         } else {
             $value = $this->getValue();
         }
         if ($this->getSettings('EDIT_IN_LIST') and !$this->getSettings('READONLY')) {
             $row->AddInputField($this->getCode(), array('style' => 'width:90%'));
         }
         $row->AddViewField($this->getCode(), $value);
     }
 }