public function run() { DB::table('sides')->delete(); DB::table('cards')->delete(); $cid = Card::create(array())['id']; echo $cid; Side::create(array('card_id' => $cid, 'descriptor' => 'front', 'text' => 'front')); Side::create(array('card_id' => $cid, 'descriptor' => 'back', 'text' => 'back')); /* Card::create(array('front' => 'hello', 'back' => 'back of card', 'count' => 10)); Card::create(array('front' => 'hello', 'back' => 'konnichiha', 'count' => 10)); */ /* for ($i=0; $i<1000; $i++) { Card::create(array('front' => 'hello', 'back' => 'konnichiha', 'count' => 10)); } */ /* */ }
/** * Change component space * * @param float $left Space in % (NULL to keep old value) * @param float $right Space in % (NULL to keep old value) * @param float $bottom Space in % (NULL to keep old value) * @param float $top Space in % (NULL to keep old value) */ function setSpace($left = NULL, $right = NULL, $bottom = NULL, $top = NULL) { $this->space->set($left, $right, $bottom, $top); }
/** * Change text margin * * @param int $left * @param int $right */ public function setTextMargin($left, $right) { $this->textMargin->set($left, $right); }
/** * Change bars size * This method is not compatible with awBarPlot::setBarPadding() * * @param int $width Bars size (between 0 and 1) */ public function setBarSize($size) { $padding = (1 - $size) / 2; $this->barPadding->set($padding, $padding); }
/** * Change axis padding * * @param int $left Left padding in pixels * @param int $right Right padding in pixels */ public function setPadding($left, $right) { $this->padding->set($left, $right); }
} } else { // extract text from bodies $textA = $this->htmlspecialchars_ent($pageB['body']); $textB = $this->htmlspecialchars_ent($pageA['body']); $sideA = new Side($textA); $sideB = new Side($textB); $bodyA = ''; $sideA->split_file_into_words($bodyA); $bodyB = ''; $sideB->split_file_into_words($bodyB); // diff on these two file $diff = new Diff(split("\n", $bodyA), split("\n", $bodyB)); // format output $fmt = new DiffFormatter(); $sideO = new Side($fmt->format($diff)); $resync_left = 0; $resync_right = 0; $count_total_right = $sideB->getposition(); $sideA->init(); $sideB->init(); $info .= '<div class="revisioninfo">' . "\n"; $info .= '<h3>' . sprintf(T_("Comparing %s for %s"), '<a title="' . sprintf(T_("Display the revision list for %s"), $pageA['tag']) . '" href="' . $this->Href('revisions') . '">' . T_("revisions") . '</a>', '<a title="' . T_("Return to the latest version of this page") . '" href="' . $this->Href() . '">' . $pageA['tag'] . '</a>') . '</h3>' . "\n"; $info .= '<ul style="margin: 10px 0">' . "\n"; $info .= ' <li><a href="' . $this->Href('show', '', 'time=' . urlencode($pageA['time'])) . '">[' . $pageA['id'] . ']</a> ' . sprintf(T_("%s by %s"), '<a class="datetime" href="' . $this->Href('show', '', 'time=' . urlencode($pageA["time"])) . '">' . $pageA['time'] . '</a>', $pageA_edited_by) . ' <span class="pagenote smaller">' . $noteA . '</span></li>' . "\n"; $info .= ' <li><a href="' . $this->Href('show', '', 'time=' . urlencode($pageB['time'])) . '">[' . $pageB['id'] . ']</a> ' . sprintf(T_("%s by %s"), '<a class="datetime" href="' . $this->Href('show', '', 'time=' . urlencode($pageB["time"])) . '">' . $pageB['time'] . '</a>', $pageB_edited_by) . ' <span class="pagenote smaller">' . $noteB . '</span></li>' . "\n"; $info .= '</ul>' . "\n"; $info .= $this->FormOpen('diff', '', 'GET'); $info .= '<input type="hidden" name="fastdiff" value="1" />' . "\n"; $info .= '<input type="hidden" name="a" value="' . $this->GetSafeVar('a', 'get') . '" />' . "\n"; $info .= '<input type="hidden" name="b" value="' . $this->GetSafeVar('b', 'get') . '" />' . "\n";
/** * Create * * Method used as a factory for rectangle side images. * Offers a quick way to send parameters and return * an image resource for output. * * @static * @access public * @param array $params Associative array of custom parameters: * - (See constructor docs for accepted values) * @return image resource for generated side image */ public static function create($params) { $s = new Side($params); return $s->image(); }