本文整理汇总了PHP中Component::getType方法的典型用法代码示例。如果您正苦于以下问题:PHP Component::getType方法的具体用法?PHP Component::getType怎么用?PHP Component::getType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Component
的用法示例。
在下文中一共展示了Component::getType方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: StyleCollection
function test_generic_component()
{
$bodyStyle = new StyleCollection("body", "hey", "Body Style", "Global style settings.");
$bodyStyle->addSP(new BackgroundColorSP("#FFFCF0"));
$bodyStyle->addSP(new ColorSP("#2E2B33"));
$bodyStyle->addSP(new FontSP("Verdana", "10pt"));
$mainBoxStyle = new StyleCollection("*.mainBoxStyle", "mainBoxStyle", "Main Box Style", "Style for the main box.");
$mainBoxStyle->addSP(new BackgroundColorSP("#FFF3C2"));
$mainBoxStyle->addSP(new BorderSP("1px", "solid", "#2E2B33"));
$mainBoxStyle->addSP(new WidthSP("750px"));
$mainBoxStyle->addSP(new MarginSP("5px"));
$mainBoxStyle->addSP(new PaddingSP("5px"));
$comp1 = new Component(null, BLANK, 3);
$style = $comp1->addStyle($bodyStyle);
$this->assertReference($style, $bodyStyle);
$comp1->addStyle($mainBoxStyle);
$this->assertReference($comp1->_styleCollections["body"], $bodyStyle);
$this->assertReference($comp1->_styleCollections["*.mainBoxStyle"], $mainBoxStyle);
$this->assertIdentical($comp1->getType(), BLANK);
$this->assertReference($comp1->getStyle("body"), $bodyStyle);
$comp2 = new Component(null, BLANK, 3, $bodyStyle, $mainBoxStyle);
$this->assertIdentical($comp2->_styleCollections["body"], $bodyStyle);
$this->assertIdentical($comp2->_styleCollections["*.mainBoxStyle"], $mainBoxStyle);
$this->assertIdentical($comp1->getType(), BLANK);
$this->assertIdentical($comp2->getIndex(), 3);
$this->assertIdentical($comp1, $comp2);
$style = $comp1->removeStyle("body");
$this->assertReference($style, $bodyStyle);
$this->assertTrue(!isset($comp1->_styleCollections["body"]));
}
示例2: flush
/**
*
* @param Component $component
* @return int id of the Component inserted in base. False if it didn't work.
*/
public static function flush($component)
{
$componentId = $component->getId();
$mark = $component->getMark();
$date = $component->getDate();
$isResit = $component->getIsResit();
$user = $component->getUser()->getId();
$componentLinked = $component->getComponent()->getId();
$module = $component->getModule()->getId();
$type = $component->getType()->getId();
if ($componentId > 0) {
$sql = 'UPDATE component c SET ' . 'c.mark = ?, ' . 'c.date = ?, ' . 'c.is_resit = ?, ' . 'c.USER_id_user = ?, ' . 'c.COMPONENT_id_component = ?, ' . 'c.MODULE_id_module = ?, ' . 'c.TYPE_id_type= ? ' . 'WHERE c.id_component = ?';
$params = array('dsiiiiii', &$mark, &$date, &$isResit, &$user, &$componentLinked, &$module, &$type, &$componentId);
} else {
$sql = 'INSERT INTO component ' . '(mark, date, is_resit, ' . 'USER_id_user, COMPONENT_id_component, MODULE_id_module, TYPE_id_type ) ' . 'VALUES(?, ?, ?, ?, ?, ?, ?) ';
$params = array('dsiiiii', &$mark, &$date, &$isResit, &$user, &$componentLinked, &$module, &$type);
}
$idInsert = BaseSingleton::insertOrEdit($sql, $params);
if ($idInsert !== false && $componentId > 0) {
$idInsert = $componentId;
}
return $idInsert;
}