本文整理汇总了PHP中ilObjStyleSheet::getMediaQueries方法的典型用法代码示例。如果您正苦于以下问题:PHP ilObjStyleSheet::getMediaQueries方法的具体用法?PHP ilObjStyleSheet::getMediaQueries怎么用?PHP ilObjStyleSheet::getMediaQueries使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ilObjStyleSheet
的用法示例。
在下文中一共展示了ilObjStyleSheet::getMediaQueries方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: create
/**
* Create a new style
*/
function create($a_from_style = 0, $a_import_mode = false)
{
global $ilDB;
parent::create();
if ($a_from_style == 0) {
if (!$a_import_mode) {
// copy styles from basic style
$this->createFromXMLFile(self::$basic_style_file, true);
// copy images from basic style
$this->createImagesDirectory();
ilUtil::rCopy(self::$basic_style_image_dir, $this->getImagesDirectory());
}
} else {
// get style parameter records
$def = array();
$q = "SELECT * FROM style_parameter WHERE style_id = " . $ilDB->quote($a_from_style, "integer");
$par_set = $ilDB->query($q);
while ($par_rec = $ilDB->fetchAssoc($par_set)) {
$def[] = array("tag" => $par_rec["tag"], "class" => $par_rec["class"], "parameter" => $par_rec["parameter"], "value" => $par_rec["value"], "type" => $par_rec["type"], "mq_id" => $par_rec["mq_id"], "custom" => $par_rec["custom"]);
}
// get style characteristics records
$chars = array();
$q = "SELECT * FROM style_char WHERE style_id = " . $ilDB->quote($a_from_style, "integer");
$par_set = $ilDB->query($q);
while ($par_rec = $ilDB->fetchAssoc($par_set)) {
$chars[] = array("type" => $par_rec["type"], "characteristic" => $par_rec["characteristic"]);
}
// copy media queries
$from_style = new ilObjStyleSheet($a_from_style);
$mqs = $from_style->getMediaQueries();
$mq_mapping = array();
foreach ($mqs as $mq) {
$nid = $this->addMediaQuery($mq["mquery"]);
$mq_mapping[$mq["id"]] = $nid;
}
// default style settings
foreach ($def as $sty) {
$id = $ilDB->nextId("style_parameter");
$q = "INSERT INTO style_parameter (id, style_id, tag, class, parameter, value, type, mq_id, custom) VALUES " . "(" . $ilDB->quote($id, "integer") . "," . $ilDB->quote($this->getId(), "integer") . "," . $ilDB->quote($sty["tag"], "text") . "," . $ilDB->quote($sty["class"], "text") . "," . $ilDB->quote($sty["parameter"], "text") . "," . $ilDB->quote($sty["value"], "text") . "," . $ilDB->quote($sty["type"], "text") . "," . $ilDB->quote((int) $mq_mapping[$sty["mq_id"]], "integer") . "," . $ilDB->quote($sty["custom"], "integer") . ")";
$ilDB->manipulate($q);
}
// insert style characteristics
foreach ($chars as $char) {
$q = "INSERT INTO style_char (style_id, type, characteristic) VALUES " . "(" . $ilDB->quote($this->getId(), "integer") . "," . $ilDB->quote($char["type"], "text") . "," . $ilDB->quote($char["characteristic"], "text") . ")";
$ilDB->manipulate($q);
}
// add style_data record
$q = "INSERT INTO style_data (id, uptodate, category) VALUES " . "(" . $ilDB->quote($this->getId(), "integer") . ", 0," . $ilDB->quote((int) $this->getScope(), "integer") . ")";
$ilDB->manipulate($q);
// copy images
$this->createImagesDirectory();
ilUtil::rCopy($from_style->getImagesDirectory(), $this->getImagesDirectory());
// copy colors
$colors = $from_style->getColors();
foreach ($colors as $c) {
$this->addColor($c["name"], $c["code"]);
}
// copy templates
$tcts = ilObjStyleSheet::_getTemplateClassTypes();
foreach ($tcts as $tct => $v) {
$templates = $from_style->getTemplates($tct);
foreach ($templates as $t) {
$this->addTemplate($tct, $t["name"], $t["classes"]);
}
}
}
$this->read();
if (!$a_import_mode) {
$this->writeCSSFile();
}
}