当前位置: 首页>>代码示例>>PHP>>正文


PHP LiteralField::__construct方法代码示例

本文整理汇总了PHP中LiteralField::__construct方法的典型用法代码示例。如果您正苦于以下问题:PHP LiteralField::__construct方法的具体用法?PHP LiteralField::__construct怎么用?PHP LiteralField::__construct使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在LiteralField的用法示例。


在下文中一共展示了LiteralField::__construct方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: __construct

 public function __construct($name, $options = array())
 {
     // Set map defaults
     $defaults = ["width" => "100%", "height" => "500px", "heading" => "", "lng_field" => "Form_ItemEditForm_Lng", "lat_field" => "Form_ItemEditForm_Lat", "tab" => "Root_Location", "address_field" => "Address", "map_zoom" => 18, "start_lat" => "51.508515", "start_lng" => "-0.125487"];
     // Merge provided options with defaults to create params
     $params = array_replace_recursive($defaults, $options);
     // Set css of map
     $css = "style='width: " . $params['width'] . "; height: " . $params['height'] . ";'";
     if (defined('GOOGLE_MAP_KEY') && empty($google_map_api_key)) {
         $google_map_api_key = GOOGLE_MAP_KEY;
     }
     if (empty($google_map_api_key)) {
         throw new InvalidArgumentException('you must provide a valid google maps api key!');
     }
     // Set up array to be fed to the JS
     $js = ["lat_field" => $params['lat_field'], "lng_field" => $params['lng_field'], "tab" => $params['tab'], "address_field" => $params['address_field'], "zoom" => $params['map_zoom'], "start_lat" => $params['start_lat'], "start_lng" => $params['start_lng'], "key" => $google_map_api_key];
     // Build content of form field
     $content = "";
     if ($params['heading']) {
         $content .= "<h4>" . $params['heading'] . "</h4>";
     }
     $content .= "<div id='admin-map-" . $name . "' class='admin-google-map' " . $css . " data-setup='" . json_encode($js) . "'></div>";
     $this->content = $content;
     // Establish requirements
     Requirements::javascript(ADMIN_GOOGLE_MAP_DIR . "/js/admin-google-map.js");
     if (!$this->stat('jquery_included')) {
         Requirements::javascript(THIRDPARTY_DIR . "/jquery/jquery.js");
     }
     parent::__construct($name, $this->content);
 }
开发者ID:OpenStackweb,项目名称:openstack-org,代码行数:30,代码来源:GoogleMapField.php

示例2: __construct

 public function __construct($content, $type = 'info', $name = null)
 {
     self::$count++;
     if ($name === null) {
         $name = 'AlertMessageField' . self::$count;
     }
     $content = '<div class="message ' . $type . '" id="' . $name . '">' . $content . '</div>';
     parent::__construct($name, $content);
 }
开发者ID:lekoala,项目名称:silverstripe-form-extras,代码行数:9,代码来源:AlertMessageField.php

示例3: COUNT

    function __construct($name, $title = "")
    {
        $totalNumberOfDaysBack = $this->numberOfDays + $this->endingDaysBack;
        $data = DB::query("\n\t\t\tSELECT COUNT(ID) myCount, \"Title\"\n\t\t\tFROM \"GoogleCustomSearchPage_Record\"\n\t\t\tWHERE Created > ( NOW() - INTERVAL " . $totalNumberOfDaysBack . " DAY )\n\t\t\t\tAND Created < ( NOW() - INTERVAL " . $this->endingDaysBack . " DAY )\n\t\t\tGROUP BY \"Title\"\n\t\t\tHAVING COUNT(\"ID\") >= {$this->minimumCount}\n\t\t\tORDER BY myCount DESC\n\t\t");
        if (!$this->minimumCount) {
            $this->minimumCount++;
        }
        $content = "";
        if ($title) {
            $content .= "<h2>" . $title . "</h2>";
        }
        $content .= "\n\t\t<div id=\"SearchHistoryTableForCMS\">\n\t\t\t<h3>Search Phrases entered at least " . $this->minimumCount . " times between " . date("Y-M-d", strtotime("-" . $totalNumberOfDaysBack . " days")) . " and " . date("Y-M-d", strtotime("-" . $this->endingDaysBack . " days")) . "</h3>\n\t\t\t<table class=\"highToLow\" style=\"width: 100%;\">";
        $list = array();
        foreach ($data as $key => $row) {
            if (!$key) {
                $maxWidth = $row["myCount"];
            }
            $multipliedWidthInPercentage = floor($row["myCount"] / $maxWidth * 100);
            $list[$row["myCount"] . "-" . $key] = $row["Title"];
            $content .= '
				<tr>
					<td style="text-align: right; width: 30%; padding: 5px;">
						' . $row["Title"] . '
					</td>
					<td style="background-color: silver;  padding: 5px; width: 70%;">
						<div style="width: ' . $multipliedWidthInPercentage . '%; background-color: #0066CC; color: #fff;">' . $row["myCount"] . '</div>
					</td>
				</tr>';
        }
        $content .= '
			</table>';
        //a - z
        asort($list);
        $content .= "\n\t\t\t<h3>A - Z with favourite links clicked</h3>\n\t\t\t<table class=\"aToz\" style=\"width: 100%;\">";
        foreach ($list as $key => $title) {
            $array = explode("-", $key);
            $multipliedWidthInPercentage = floor($array[0] / $maxWidth * 100);
            $titleData = DB::query("\n\t\t\t\tSELECT COUNT(ID) myCount, \"URL\"\n\t\t\t\tFROM \"GoogleCustomSearchPage_Record\"\n\t\t\t\tWHERE Created > ( NOW() - INTERVAL " . $totalNumberOfDaysBack . " DAY )\n\t\t\t\t\tAND Created < ( NOW() - INTERVAL " . $this->endingDaysBack . " DAY )\n\t\t\t\t\tAND \"Title\" = '" . $title . "'\n\t\t\t\tGROUP BY \"URL\"\n\t\t\t\tHAVING COUNT(\"ID\") >= {$this->minimumCount}\n\t\t\t\tORDER BY myCount DESC\n\t\t\t\tLIMIT 3;\n\t\t\t");
            unset($urlArray);
            $urlArray = array();
            foreach ($titleData as $urlRow) {
                $urlArray[] = "<li>" . $urlRow["myCount"] . ": " . $urlRow["URL"] . "</li>";
            }
            $content .= '
				<tr>
					<td style="text-align: right; width: 30%; padding: 5px;">' . $title . '</td>
					<td style="background-color: silver;  padding: 5px; width: 70%">
						<div style="width: ' . $multipliedWidthInPercentage . '%; background-color: #0066CC; color: #fff;">' . trim($array[0]) . '</div>
						<ul style="font-size: 10px">' . implode($urlArray) . '</ul>
					</td>
				</tr>';
        }
        $content .= '
			</table>
		</div>';
        return parent::__construct($name, $content);
    }
开发者ID:helpfulrobot,项目名称:sunnysideup-googlecustomsearch,代码行数:57,代码来源:GoogleCustomSearchPage_RecordField.php

示例4: DataObject

 function __construct($controller, $name, $class = 'Page', $limit = 30)
 {
     Requirements::javascript(ABC_PATH . '/javascript/child-list.js');
     Requirements::css(ABC_PATH . '/css/child-list.css');
     $do = new DataObject();
     $do->DataSet = AddPaginator::get($limit)->fetch($class, "SiteTree.ParentID = " . $controller->ID, "PublicationDate DESC, Created DESC");
     $do->Paginator = $do->DataSet->Paginator->dataForTemplate(null, null, '/admin/getitem?ID=' . $controller->ID);
     $parser = SSViewer::fromString(SSViewer::getTemplateContent('ChildList'));
     $str = $parser->process($do);
     parent::__construct($name, $str);
 }
开发者ID:helpfulrobot,项目名称:azt3k-abc-silverstripe,代码行数:11,代码来源:ChildListField.php

示例5: ArrayList

 function __construct($name, $ClassName)
 {
     Requirements::javascript(THIRDPARTY_DIR . "/jquery/jquery.js");
     //Requirements::block(THIRDPARTY_DIR."/jquery/jquery.js");
     //Requirements::javascript(Director::protocol()."ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js");
     Requirements::javascript("dataobjectsorter/javascript/jquery-ui-1.7.2.custom.min.js");
     Requirements::themedCSS("dataobjectsorter", "dataobjectsorter");
     $objects = $ClassName::get();
     $arrayList = new ArrayList();
     $dos->Children = $objects;
     $content = $this->customise($arrayList)->renderWith("DataObjectSorterField");
     parent::__construct($name, $content);
 }
开发者ID:helpfulrobot,项目名称:sunnysideup-dataobjectsorter,代码行数:13,代码来源:DataObjectSorterField.php

示例6: COUNT

    function __construct($name, $title = "")
    {
        $totalNumberOfDaysBack = $this->numberOfDays + $this->endingDaysBack;
        $data = DB::query("\n\t\t\tSELECT COUNT(ID) myCount, \"Title\"\n\t\t\tFROM \"SearchHistory\"\n\t\t\tWHERE Created > ( NOW() - INTERVAL " . $totalNumberOfDaysBack . " DAY )\n\t\t\t\tAND Created < ( NOW() - INTERVAL " . $this->endingDaysBack . " DAY )\n\t\t\tGROUP BY \"Title\"\n\t\t\tHAVING COUNT(\"ID\") >= {$this->minimumCount}\n\t\t\tORDER BY myCount DESC\n\t\t");
        if (!$this->minimumCount) {
            $this->minimumCount++;
        }
        $content = "";
        if ($title) {
            $content .= "<h2>" . $title . "</h2>";
        }
        $content .= "\n\t\t<div id=\"SearchHistoryTableForCMS\">\n\t\t\t<h3>Search Phrases entered at least " . $this->minimumCount . " times between " . date("Y-M-d", strtotime("-" . $totalNumberOfDaysBack . " days")) . " and " . date("Y-M-d", strtotime("-" . $this->endingDaysBack . " days")) . "</h3>\n\t\t\t<table class=\"highToLow\" style=\"widht: 100%\">";
        $list = array();
        foreach ($data as $key => $row) {
            //for the highest count, we work out a max-width
            if (!$key) {
                $maxWidth = $row["myCount"];
            }
            $multipliedWidthInPercentage = floor($row["myCount"] / $maxWidth * 100);
            $list[$row["myCount"] . "-" . $key] = $row["Title"];
            $content .= '
				<tr>
					<td style="text-align: right; width: 30%; padding: 5px;">' . $row["Title"] . '</td>
					<td style="background-color: silver;  padding: 5px; width: 70%;">
						<div style="width: ' . $multipliedWidthInPercentage . '%; background-color: #0066CC; color: #fff;">' . $row["myCount"] . '</div>
					</td>
				</tr>';
        }
        $content .= '
			</table>';
        asort($list);
        $content .= "\n\t\t\t<h3>A - Z</h3>\n\t\t\t<table class=\"aToz\" style=\"widht: 100%\">";
        foreach ($list as $key => $title) {
            $array = explode("-", $key);
            $multipliedWidthInPercentage = floor($array[0] / $maxWidth * 100);
            $content .= '
				<tr>
					<td style="text-align: right; width: 30%; padding: 5px;">' . $title . '</td>
					<td style="background-color: silver;  padding: 5px; width: 70%">
						<div style="width: ' . $multipliedWidthInPercentage . '%; background-color: #0066CC; color: #fff;">' . trim($array[0]) . '</div>
					</td>
				</tr>';
        }
        $content .= '
			</table>
		</div>';
        return parent::__construct($name, $content);
    }
开发者ID:TouchtechLtd,项目名称:silverstripe-ecommerce,代码行数:48,代码来源:EcommerceSearchHistoryFormField.php

示例7: __construct

 public function __construct($name, $content, $label = '')
 {
     parent::__construct($name, $content);
     $this->title = $label;
 }
开发者ID:helpfulrobot,项目名称:milkyway-multimedia-ss-mwm-formfields,代码行数:5,代码来源:FlyoutLabelField.php

示例8: __construct

 public function __construct($name, $content, $class = 'notice')
 {
     $content = '<p class="noticefield message ' . $class . '">' . $content . '</p>';
     parent::__construct($name, $content);
 }
开发者ID:helpfulrobot,项目名称:axllent-silverstripe-cms-tweaks,代码行数:5,代码来源:NoticeField.php

示例9: __construct

 /**
  * Builds the action
  * @param string                          $text    The text to appear on the button
  */
 public function __construct($text = null)
 {
     $this->buttonText = $text;
     parent::__construct($this->getButtonName(), "");
 }
开发者ID:rchntrl,项目名称:silverstripe-gridfield-betterbuttons,代码行数:9,代码来源:BetterButtonAction.php

示例10: __construct

 public function __construct($name)
 {
     parent::__construct($name, '');
 }
开发者ID:helpfulrobot,项目名称:milkyway-multimedia-ss-mwm-formfields,代码行数:4,代码来源:HorizontalRuleField.php

示例11:

 function __construct($name, $additionalContent = '', $productID)
 {
     Requirements::themedCSS("CreateEcommerceVariationsField");
     $additionalContent .= $this->renderWith("CreateEcommerceVariations_Field");
     parent::__construct($name, $additionalContent);
 }
开发者ID:riddler7,项目名称:silverstripe-product-variations,代码行数:6,代码来源:CreateEcommerceVariations.php

示例12: __construct

 public function __construct($name, $content, $link)
 {
     $this->link = $link;
     parent::__construct($name, $content);
 }
开发者ID:helpfulrobot,项目名称:milkyway-multimedia-ss-mwm-formfields,代码行数:5,代码来源:FormActionLink.php

示例13:

 function __construct($name, $title = "")
 {
     return parent::__construct($name, $title);
 }
开发者ID:helpfulrobot,项目名称:sunnysideup-ecommerce,代码行数:4,代码来源:EcommerceSearchHistoryFormField.php

示例14:

 function __construct($name, $title, $content)
 {
     parent::__construct($name, $content);
     $this->setTitle($title);
 }
开发者ID:ramziammar,项目名称:websites,代码行数:5,代码来源:LabelledLiteralField.php

示例15: __construct

 public function __construct($name, $content, $type = 'good')
 {
     $this->type = $type;
     parent::__construct($name, $content);
 }
开发者ID:helpfulrobot,项目名称:milkyway-multimedia-ss-mwm-formfields,代码行数:5,代码来源:FormMessageField.php


注:本文中的LiteralField::__construct方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。