Exemplo n.º 1
0
 /**
  * Add javascripts, handle removing if item types and show the list of them.
  *
  * @return void
  */
 public function process()
 {
     $this->template->loadJs('itemType');
     $this->getTemplate()->loadJs('jquery.ajax');
     $this->getTemplate()->loadJs('removeRow');
     $this->getTemplate()->loadJs('jquery.popupEdit');
     $itemTypesListing = \Listing\ItemTypes::loadList();
     switch ($_GET['action']) {
         case 'remove':
             $this->removeItemType($itemTypesListing->getById($_GET['id']));
             break;
         case 'edit':
             $this->editItemType($_GET['id'], $_POST['data']);
             $itemTypesListing->loadList();
             break;
         case 'get':
             $this->getItemType($itemTypesListing->getById($_GET['id']));
             break;
     }
     $this->getTemplate()->assign('itemTypeListing', $itemTypesListing);
 }
Exemplo n.º 2
0
    /**
     * 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')));
    }