本文整理汇总了PHP中Part类的典型用法代码示例。如果您正苦于以下问题:PHP Part类的具体用法?PHP Part怎么用?PHP Part使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Part类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: savePart
private function savePart()
{
$form = 'frost.views.cms.part.text.TextAdd';
$part = Part::addMediaToPart($form,'Text');
// Add the 'preview' to the part
$part = new Part();
$part->clauseSafe('part_id',Application::param('part_id'));
$part->parse();
$part->save();
//Part::setParttagsAndSave($part,Application::param('current_tags'));
Application::setParam('module_id',Application::param('module_id'));
Application::redirect('ModuleDetail');
}
示例2: getTree
private function getTree()
{
if ($root = Part::model()->find('alias="carclub"')) {
$tree = $this->convertMenuTree($root->getNestedTree());
}
return $tree;
}
示例3: read_part
public static function read_part($part)
{
// create temporary quote for one part
$item = ['quote_id' => 0, 'quantity' => 1, 'override' => null];
$item += Part::read_part($part);
$item['annual_fee'] = $item['price'];
$quote = ['id' => 0, 'created' => null, 'key' => null, 'company' => null, 'address' => null, 'country' => null, 'billing_name' => null, 'billing_email' => null, 'billing_phone' => null, 'technical_name' => null, 'technical_email' => null, 'discount' => null, 'discount_desc' => null, 'first_fee' => $item['annual_fee'], 'annual_fee' => $item['annual_fee'], 'items' => [$item]];
return $quote;
}
示例4: doParseBoundary
private function doParseBoundary($boundary)
{
$result = array();
$prefix = "--" . $boundary;
$this->consumeRegexp("/\n*/");
$this->consumeTo($prefix);
$this->consume($prefix);
while ($this->expects("\n")) {
$content = $this->consumeTo("\n" . $prefix);
$part = new Part();
$part->loadSource($content);
if ($part->isMultipart()) {
$result += $part->getParts();
} else {
$result[] = $part;
}
$this->consume("\n" . $prefix);
}
return $result;
}
示例5: execute
public function execute($smarty, $params, $session)
{
$smarty->assign('name', $session['screen_name']);
$artists = Artist::findAll();
$smarty->assign('artists', $artists);
$songs = Song::findAll();
$smarty->assign('songs', $songs);
$parts = Part::findAll();
$smarty->assign('parts', $parts);
$smarty->display('index.tpl');
}
示例6: read_items
public static function read_items($quote_id)
{
$items = QuoteItem::read(['*'], FALSE, ['quote_id = ?', $quote_id]);
for ($i = 0; $i < count($items); ++$i) {
$part = Part::read_part($items[$i]['part']);
unset($part['id']);
$items[$i] += $part;
if (!is_null($items[$i]['override'])) {
$items[$i]['price'] = $items[$i]['override'];
}
$items[$i]['annual_fee'] = $items[$i]['price'] * $items[$i]['quantity'];
}
return $items;
}
示例7: draw
public function draw()
{
$args = func_get_args();
$clone = clone $this;
$clone->set('name', $this->getFormName());
$clone->set('id', $this->getId());
$clone->curry($args);
try {
Part::drawArray($clone->partPath, $clone->args);
return true;
} catch (MissingRequiredInputException $e) {
throw new MissingRequiredDrawArgumentsException($e->getMessage(), 1);
}
}
示例8: constructFromArray
public static function constructFromArray($props)
{
$name = $props['name'];
$parts = array();
if (isset($props['parts'])) {
foreach ($props['parts'] as $part) {
if ($part instanceof Part) {
$parts[] = $part;
} else {
$parts[] = Part::constructFromArray($part);
}
}
}
return new Score($name, $parts);
}
示例9: __construct
/**
* Construct the object
*
* @access public
* @param array $parts
* @param array $classes
* @param string $key
* @param integer $priority
*
* @throws \Zepi\Web\UserInterface\Exception Only Tab objects are allowd to add to a Tabs object.
*/
public function __construct($parts = array(), $classes = array(), $key = '', $priority = 10)
{
parent::__construct(array(), $classes, $key, $priority);
if (is_array($parts)) {
foreach ($parts as $part) {
if ($part instanceof \Zepi\Web\UserInterface\Layout\Tab) {
// Activate the first tab
if (count($this->parts) === 0) {
$part->setActive(true);
}
$this->addPart($part);
} else {
throw new Exception('Only Tab objects are allowed to add to a Tabs object.');
}
}
}
}
示例10: order_custom
public function order_custom($params = [])
{
$parts = Part::get_parts();
$order = Record::allow($params, array_keys($parts));
$key = Quote::get_unique_key([]);
$model['`key`'] = $key;
$fields = ['company', 'address', 'country', 'billing_name', 'billing_email', 'billing_phone', 'technical_name', 'technical_email', 'discount', 'discount_desc'];
$model += Record::allow($params, $fields);
$quote = Quote::create($model);
$total = 0;
foreach ($order as $name => $value) {
if ($value) {
$model = ['quote_id' => $quote['id'], 'part' => $name, 'override' => null, 'quantity' => $value];
QuoteItem::create($model);
}
}
return Render::json(['key' => $key]);
}
示例11: __construct
/**
* Public constructor
*
* In addition to the parameters of Part::__construct() this constructor supports:
* - file filename or file handle of a file with raw message content
* - flags array with flags for message, keys are ignored, use constants defined in \Zend\Mail\Storage
*
* @param string $rawMessage full message with or without headers
* @throws Exception
*/
public function __construct(array $params)
{
if (isset($params['file'])) {
if (!is_resource($params['file'])) {
$params['raw'] = @file_get_contents($params['file']);
if ($params['raw'] === false) {
throw new Exception\RuntimeException('could not open file');
}
} else {
$params['raw'] = stream_get_contents($params['file']);
}
}
if (!empty($params['flags'])) {
// set key and value to the same value for easy lookup
$this->_flags = array_combine($params['flags'], $params['flags']);
}
parent::__construct($params);
}
示例12: add
public static function add($userId, $artistName, $songName, $partName)
{
$pdo = new PDO('mysql:host=localhost; dbname=twitter_band', 'root', '');
$pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$artist = Artist::insertAndGet($pdo, $artistName);
$song = Song::insertAndGet($pdo, $songName, $artist);
$part = Part::insertAndGet($pdo, $partName);
$st = $pdo->prepare('
select * from repertoire
where user_id = ? and artist_id = ? and song_id = ? and part_id = ?');
$st->execute(array($userId, $artist->id, $song->id, $part->id));
if ($row = $st->fetch()) {
return true;
} else {
$st = $pdo->prepare('
insert into repertoire(user_id, artist_id, song_id, part_id) values(?,?,?,?)');
$res = $st->execute(array($userId, $artist->id, $song->id, $part->id));
return true;
}
}
示例13: store
/**
* Store a newly created resource in storage.
*
* @return Response
*/
public function store($story)
{
$input = $request->all();
$story_id = $story;
$chapter = new chapter();
$part->story_id = $story_id;
$part->title = $input['title'];
$part->description = $input['description'];
//place of part
$position = 0;
$current_position = Part::where('story_id', $story)->pluck('position');
if (empty($current_positioncount)) {
$current_position = 0;
} else {
$current_position;
}
//current_position = 1
if ($position <= $current_position) {
$position = $current_position + 1;
//expect position to go to 2
} else {
$position = $current_position;
}
$part->position = $position;
//setting position 2
$part->save();
//image
$destinatonPath = '';
$filename = '';
$file = Input::file('image');
$destinationPath = public_path() . '/images/parts';
$filename = $part->id . '_' . $file->getClientOriginalName();
$uploadSuccess = $file->move($destinationPath, $filename);
$addimage = Part::find($part->id);
$addimage->image = $filename;
$addimage->save();
return redirect('story/' . $story . '/edit');
}
示例14: switch
}
///end of selectlist class
if (isset($_GET['type'])) {
switch ($_GET['type']) {
case 'customer':
$cust = new Customer();
$cust->createCustomerList();
if (isset($_GET['id'])) {
$id = $_GET['id'];
} else {
$id = 'Customer_ID';
}
$sel = new selectlist($id, $cust->getCustomerList(), 'Select Customer', 'Customer_ID', 'Customer_Name_Short', 'class="required"', '', '1');
break;
case 'drawing':
$part = new Part();
$part->createPartList($_GET['cid']);
if (isset($_GET['req'])) {
$req = 'class=required';
} else {
$req = '';
}
if (isset($_GET['id'])) {
$id = $_GET['id'];
} else {
$id = 'Drawing_ID';
}
$sel = new selectlist($id, $part->getPartList(), 'Select Part No', 'Drawing_ID', 'name', $req, '');
break;
case 'operator':
$operator = new Operator();
示例15: getpart
private function getpart($type)
{
$items = Part::find(array("type=:type:", "bind" => array("type" => $type)));
$parts = array();
foreach ($items as $index => $item) {
$parts[$index] = $item;
}
return $parts;
}