示例#1
0
 public function FileAppend($filehash, $title)
 {
     if (!$this->manager->IsAdminRole()) {
         return 403;
     }
     $fileid = PriceQuery::FileAppend($this, $filehash, $title);
     $ret = new stdClass();
     $ret->fileid = $fileid;
     return $ret;
 }
 protected function init()
 {
     // this call makes sure we get all the settings of the parent class
     parent::init();
     $this->setQuery('price:[5 TO *]');
 }
示例#3
0
                    $item->setIsbn($isbn)->setTitle($title)->setAuthor($author)->setPublisher($publisher)->setEdition($date)->save();
                    $shi = new BnSectionHasItem();
                    $shi->setSection($section)->setItem($item)->setRequiredStatus($requireType)->save();
                } else {
                    // different BN items have the same author.  f**k.
                    echo "\tmultiple items, meh.\n";
                    // compare the titles
                    $maxScore = 0;
                    $best = null;
                    foreach ($matchingItems as $it) {
                        $score = similar_text($it->getTitle(), $title);
                        if ($score > $maxScore) {
                            $maxScore = $score;
                            $best = $it;
                        }
                    }
                    if ($best) {
                        $best->setIsbn($isbn)->save();
                        $idsAlreadyTaken[] = $best->getId();
                    }
                    $item = $best;
                }
            }
            $book = BookQuery::create()->filterByIsbn($isbn)->findOneOrCreate();
            $book->save();
            $oldPrices = PriceQuery::create()->filterByItemId($item->getId())->update(array('Isbn' => $isbn));
            //BnSection::createPricesByBook($book, null, $price, Vendor::BNCOLLEGE);
        }
    }
    //die();
}