コード例 #1
0
ファイル: Techniques.php プロジェクト: friend8/DSA-Blacksmith
 /**
  * Add javascripts, handle removing of techniques and show the list of them.
  *
  * @return void
  */
 public function process()
 {
     $this->template->loadJs('technique');
     $this->getTemplate()->loadJs('jquery.ajax');
     $this->getTemplate()->loadJs('removeRow');
     $this->getTemplate()->loadJs('jquery.popupEdit');
     $techniqueListing = \Listing\Techniques::loadList();
     switch ($_GET['action']) {
         case 'remove':
             $this->removeTechnique($techniqueListing->getById($_GET['id']));
             break;
         case 'edit':
             $this->editItem($_GET['id'], $_POST['data']);
             break;
         case 'get':
             $this->getTechnique($techniqueListing->getById($_GET['id']));
             break;
     }
     $this->getTemplate()->assign('techniqueListing', $techniqueListing);
 }
コード例 #2
0
ファイル: Blueprints.php プロジェクト: friend8/DSA-Blacksmith
    /**
     * Add javascripts, handle the removing of blueprints and show the blueprints list.
     *
     * @return void
     */
    public function process()
    {
        $this->getTemplate()->loadJs('addBlueprint');
        $this->getTemplate()->loadJs('jquery.materialSelect');
        $this->getTemplate()->loadJs('jquery.techniqueSelect');
        $this->getTemplate()->loadJs('jquery.blueprint');
        $this->getTemplate()->loadJs('showBlueprint');
        $this->getTemplate()->loadJsReadyScript('
			$(document).tooltip({
				content: function () {
					$(this).addClass("tooltip");
					return $(this).attr("title").replace(/(?:\\r\\n|\\r|\\n)/g, "<br />");
				}
			});
			$(".addTalentPoints").addTalentPoints();
		');
        $blueprintListing = \Listing\Blueprints::loadList();
        $itemListing = \Listing\Items::loadList();
        $itemTypeListing = \Listing\ItemTypes::loadList();
        $materialListing = \Listing\Materials::loadList();
        $techniqueListing = \Listing\Techniques::loadList();
        $moneyHelper = new \Helper\Money();
        if ($_GET['remove']) {
            $this->removeBlueprint($blueprintListing->getById($_GET['remove']));
        }
        $translator = \SmartWork\Translator::getInstance();
        $this->getTemplate()->assign('blueprintListing', $blueprintListing);
        $this->getTemplate()->assign('itemListing', $itemListing);
        $this->getTemplate()->assign('itemTypeListing', $itemTypeListing);
        $this->getTemplate()->assign('materialListing', $materialListing);
        $this->getTemplate()->assign('materialList', json_encode($materialListing->getAsArray()));
        $this->getTemplate()->assign('techniqueListing', $techniqueListing);
        $this->getTemplate()->assign('techniqueList', json_encode($techniqueListing->getAsArray()));
        $this->getTemplate()->assign('currencyList', $moneyHelper->getCurrencyList());
        $talentList = array('bowMaking' => $translator->gt('bowMaking'), 'precisionMechanics' => $translator->gt('precisionMechanics'), 'blacksmith' => $translator->gt('blacksmith'), 'woodworking' => $translator->gt('woodworking'), 'leatherworking' => $translator->gt('leatherworking'), 'tailoring' => $translator->gt('tailoring'));
        asort($talentList, SORT_NATURAL);
        $this->getTemplate()->assign('talentList', json_encode($talentList));
        $this->assign('columsPerItemType', array('meleeWeapon' => array('blueprint', 'item', 'itemType', 'damageType', 'materials', 'techniques', 'upgradeHitPoints', 'upgradeBreakFactor', 'upgradeInitiative', 'upgradeWeaponModificator'), 'rangedWeapon' => array('blueprint', 'item', 'itemType', 'damageType', 'materials', 'bonusRangedFightValue', 'reducePhysicalStrengthRequirement')));
    }