Szablon może być pojedynczym plikiem (wówczas silnik działa tak jak silnik
{@link VelocityFileEngine}, lub katalogiem. W takiej sytuacji przetwarzane
są wszsytkie jego wpisy.
766957
@Override
	protected void processVelocityResource(ITemplateSource source, VelocityContext context, String target) throws Exception {
		if(source.isFile()) {
			super.processVelocityFile(source.getEntry(source.getResource()), context, target);
		} else if(source.isDirectory()) {
			for(ITemplateSourceEntry entry : source.listEntries()) {
				if(entry.isFile()) {
					processVelocityFile(entry, context, target);
				} else if(entry.isDirectory()) {
					processVelocityDirectory(entry, context, target);
				}
			}
		}
	}
24120
public function addAction()
    {
        //wyszukiwanie kategorii
        if (null === $cat = (new \Cms\Orm\CmsCategoryQuery)->findPk($this->id)) {
            return;
        }
        //zakładka sekcje
        $widgetForm = (new \CmsAdmin\Form\CategoryAddWidget($cat));
        //zapisany form
        if ($widgetForm->isSaved()) {
            $this->getResponse()->redirect('cmsAdmin', 'categoryWidgetRelation', 'config', ['categoryId' => $this->id, 'widgetId' => $widgetForm->getElement('cmsWidgetId')->getValue()]);
        }
        //form do widoku
        $this->view->widgetForm = $widgetForm;
    }
393475
function(){
		// this.bodyが空の場合はEncode.jsの仕様により対象外
		// カンペンには以下のパズルは存在しないのでURL_KANPENPも対象外
		if(!this.body || (this.type!==URL_PZPRV3 && this.type!==URL_PZPRAPP)){ return;}
		
		switch(this.pid){
		case 'ichimaga':
			if     (this.pflag.indexOf('m')>=0){ this.pid = 'ichimagam';}
			else if(this.pflag.indexOf('x')>=0){ this.pid = 'ichimagax';}
			else                               { this.pid = 'ichimaga'; }
			break;
		case 'icelom':
			if(this.pflag.indexOf('a')<0){ this.pid = 'icelom2';}
			break;
		case 'pipelink':
			if(this.body.match(/[0-9]/)){ this.pid = 'pipelinkr';}
			break;
		case 'bonsan':
			if(this.pflag.indexOf('c')<0){
				var col = this.cols, row = this.rows;
				if(this.body.substr(0,((((col-1)*row+4)/5)|0)+(((col*(row-1)+4)/5)|0)||0).match(/[^0]/)){
					this.pid = 'heyabon';
				}
			}
			break;
		case 'kramma':
			if(this.pflag.indexOf('c')<0){
				var len=(this.cols-1)*(this.rows-1), cc=0;
				for(var i=0;i<this.body.length;i++){
					var ca = this.body.charAt(i);
					if(ca.match(/\w/)){
						cc += parseInt(ca,36);
						if(cc<len){ this.pid = 'kramman'; break;}
					}
					else if(ca === '.'){ cc+=36;}
					if(cc>=len){ break;}
				}
			}
			break;
		}
	}
119486
public static function monthly($object, $objectId, $year)
    {
        $statArray = [];
        //pobieranie rekordów
        foreach (self::getRows($object, $objectId, $year, true, null, null) as $stat) {
            $stat->month = str_pad($stat->month, 2, '0', STR_PAD_LEFT);
            $statArray[$stat->year . '-' . $stat->month] = $stat->count;
        }
        $stats = [];
        //dodawanie do kubełków miesięcy
        for ($i = 1; $i <= 12; $i++) {
            $month = str_pad($i, 2, '0', STR_PAD_LEFT);
            $count = 0;
            if (isset($statArray[$year . '-' . $month])) {
                $count = $statArray[$year . '-' . $month];
            }
            $stats[$year . '-' . $month] = $count;
        }
        return $stats;
    }
501456
public function deleteAction()
    {
        //szukamy rekordu pliku
        if (!$this->getPost()->cmsFileId || null === $record = (new CmsFileQuery)->findPk($this->getPost()->cmsFileId)) {
            return $this->_jsonError(178);
        }
        //sprawdzenie zgodności z obiektem formularza
        if ($record->object === $this->getPost()->object && $record->objectId == $this->getPost()->objectId) {
            //usuwanie
            if ($record->delete()) {
                //jeśli wykonać operację po usunięciu
                if ($this->getPost()->afterDelete) {
                    $this->_operationAfter($this->getPost()->afterDelete, $record);
                }
                return json_encode(['result' => 'OK']);
            }
        }
        return $this->_jsonError(178);
    }
263463
function f_ekle(es_ihale, db_ihale, kurum_id, tahta_id, _kul_id) {

        //SON EKLENEN İHALENİN İD SİNİ ÇEK VE EKLEME İŞLEMİNE BAŞLA
        return result.dbQ.incr(result.kp.ihale.idx)
            .then(function (_id) {
                db_ihale.Id = _id;
                es_ihale.Id = _id;

                return result.dbQ.Q.all([
                        result.dbQ.hset(result.kp.ihale.tablo, _id, JSON.stringify(db_ihale)),
                        result.dbQ.zadd(result.kp.ihale.zsetYapilmaTarihi, db_ihale.IhaleTarihi, db_ihale.Id)

                    ])
                    .then(function () {

                        if (tahta_id && tahta_id > 0) {
                            //tahta ile ilişkilendir
                            return result.dbQ.sadd(result.kp.tahta.ssetOzelIhaleleri(tahta_id, true), db_ihale.Id);
                        } else {
                            return result.dbQ.sadd(result.kp.ihale.ssetGenel, db_ihale.Id);
                        }

                    })
                    .then(function () {
                        //kurumun ihalelerine ekle
                        //ihalenin kurumunu ata
                        if (kurum_id > 0) {
                            return result.dbQ.Q.all([
                                result.dbQ.sadd(result.kp.kurum.ssetIhaleleri(kurum_id), db_ihale.Id),
                                result.dbQ.hset(result.kp.ihale.hsetYapanKurumlari, db_ihale.Id, kurum_id)
                            ]);
                        }
                        return db_ihale;
                    })
                    .then(function () {
                        //sisteme eklenme tarihini ekle
                        if (db_ihale.SistemeEklenmeTarihi) {
                            return result.dbQ.zadd(result.kp.ihale.zsetSistemeEklenmeTarihi, db_ihale.SistemeEklenmeTarihi, db_ihale.Id)
                        }
                        return db_ihale;
                    })
                    .then(function () {
                        //saglıkbank_id sini ekle
                        if (db_ihale.SBIhale_Id && db_ihale.SBIhale_Id > 0) {
                            return result.dbQ.zadd(result.kp.ihale.zsetSaglikbank, db_ihale.Id, db_ihale.SBIhale_Id)
                        }
                        return db_ihale;
                    })
                    .then(function () {
                        emitter.emit(schema.SABIT.OLAY.IHALE_EKLENDI, es_ihale, kurum_id, tahta_id, _kul_id);

                        //ihale bilgisini dön
                        /** @type {OptionsIhale} */
                        var opts = {};
                        opts.bArrKalemleri = true;
                        opts.bYapanKurum = true;
                        opts.bTakip = true;
                        return f_id(db_ihale.Id, tahta_id, opts);
                    });
            })
            .fail(function (_err) {
                throw new exception.Istisna("İhale Eklenemedi!", "İhale eklenirken Hata oluştu: " + _err);
            });
    }
1075514
public function init()
    {

        //adres
        $this->addElement((new Element\Text('address'))
            ->setLabel('form.mail.server.address.label'));

        //ssl
        $this->addElement((new Element\Select('ssl'))
            ->setLabel('form.mail.server.ssl.label')
            ->setRequired()
            ->addValidator(new \Mmi\Validator\NotEmpty)
            ->setMultioptions(['plain' => 'plain', 'tls' => 'tls', 'ssl' => 'ssl']));

        //port
        $this->addElement((new Element\Text('port'))
            ->setLabel('form.mail.server.port.label')
            ->setRequired()
            ->addValidator(new \Mmi\Validator\Integer([true]))
            ->setValue(25)
            ->setDescription('Plain: 25, SSL: 465, TLS: 587'));

        //użytkownik
        $this->addElement((new Element\Text('username'))
            ->setLabel('form.mail.server.username.label'));

        //hasło
        $this->addElement((new Element\Text('password'))
            ->setLabel('form.mail.server.password.label'));

        //od
        $this->addElement((new Element\Text('from'))
            ->setLabel('form.mail.server.from.label'));

        //submit
        $this->addElement((new Element\Submit('submit'))
            ->setLabel('form.mail.server.submit.label'));
    }
96230
public function uploaderAction()
    {
        //parametry dla ajaxa
        $this->view->ajaxParams = [
            'module' => 'cms',
            'controller' => 'file',
            'action' => 'upload',
            'class' => $this->class,
            'object' => $this->object,
            'objectId' => $this->objectId,
            'types' => $this->types,
            'js' => $this->js,
            //znacznik czasu
            't' => $t = round(microtime(true)),
            //hash zabezpieczający oparty o znacznik czasu
            'hash' => md5($t . '+' . \Mmi\Session\Session::getId() . '+' . $this->class)
        ];
        //blad
        $this->view->error = $this->error;
        //lista obrazów
        $this->view->images = \Cms\Orm\CmsFileQuery::imagesByObject($this->object, $this->objectId)
            ->orderAscDateAdd()
            ->find();
        //lista pozostałych plików
        $this->view->files = \Cms\Orm\CmsFileQuery::notImagesByObject($this->object, $this->objectId)
            ->orderAscDateAdd()
            ->find();
    }
362004
public function pluploadAction()
    {
        set_time_limit(5 * 60);
        //obiekt handlera plupload
        $pluploadHandler = new Model\PluploadHandler();
        //jeśli wystąpił błąd
        if (!$pluploadHandler->handle()) {
            return $this->_jsonError($pluploadHandler->getErrorCode(), $pluploadHandler->getErrorMessage());
        }
        //jeśli wykonać operację po przesłaniu całego pliku i zapisaniu rekordu
        if ($this->getPost()->afterUpload && null !== $record = $pluploadHandler->getSavedCmsFileRecord()) {
            $this->_operationAfter($this->getPost()->afterUpload, $record);
        }
        return json_encode(['result' => 'OK', 'cmsFileId' => $pluploadHandler->getSavedCmsFileId()]);
    }
27948
public static function postInstall(Event $event) 
    { 
        //inicjalizacja autoloadera 
        self::_initAutoload($event); 
        //kopiowanie plików z dystrybucji 
        self::_copyDistFiles(); 
        //linkowanie zasobów web 
        self::_linkModuleWebResources(); 
        //kopiowanie binariów z modułów 
        self::_copyModuleBinaries(); 
    }
20061
public function getRelationFiles()
    {
        $filesByObject = new \Mmi\Orm\RecordCollection;
        //wyszukiwanie wartości
        foreach ($this->getAttributeValues() as $record) {
            //pobieranie klucza atrybutu (w celu zgrupowania)
            if ($record->getJoined('cms_attribute_type')->uploader) {
                //dołączanie plików
                foreach (\Cms\Orm\CmsFileQuery::byObject($record->value, $this->_objectId)->find() as $file) {
                    $filesByObject->append($file);
                }
            }
        }
        return $filesByObject;
    }
129777
public function filesAction()
    {
        //formularz
        $form = new Form\ConnectorImportFilesForm;
        //formularz zapisany
        if ($form->isSaved()) {
            //przekazanie listy plików do downloadu
            $this->view->files = $form->getOption('data');
            //otwarcie sesji
            $session = new \Mmi\Session\SessionSpace(\Cms\Model\ConnectorModel::SESSION_SPACE);
            $this->view->downloadUrl = base64_encode($session->url);
        } else {
            //form do widoku
            $this->view->form = $form;
        }
    }
1124552
public function delete()
    {
        //usuwanie meta
        if (!parent::delete()) {
            return false;
        }
        //plik jest ciągle potrzebny (ma linki)
        if (0 != (new CmsFileQuery)->whereName()->equals($this->name)->count()) {
            return true;
        }
        //kasowanie z systemu plików
        (new \Cms\Model\FileSystemModel($this->name))->unlink();
        //usuwanie rekordu
        return true;
    }
193905
protected function _createTempFiles()
    {
        //jeśli już są pliki tymczasowe, to wychodzimy
        if ((new \Cms\Orm\CmsFileQuery)
            ->byObject('tmp-' . $this->getUploaderObject(), $this->getUploaderId())
            ->count()) {
            return true;
        }
        $objectId = null;
        if ($this->_form->hasRecord()) {
            $objectId = $this->_form->getRecord()->getPk();
        }
        //tworzymy pliki tymczasowe - linki do oryginałów
        \Cms\Model\File::link($this->getUploaderObject(), $objectId, 'tmp-' . $this->getUploaderObject(), $this->getUploaderId());
        return true;
    }
1207365
public function init()
    {
        //wczytywanie sesji
        $session = new \Mmi\Session\SessionSpace(\Cms\Model\ConnectorModel::SESSION_SPACE);
        try {
            $data = (new \Cms\Model\ConnectorModel)->getData($session->url, 'exportFileObject', [], $session->identity, $session->credential);
        } catch (\Cms\Exception\ConnectorException $e) {
            //rollback - puste dane
            $data = [];
        }

        //obiekty do przesłania
        if (!empty($data)) {
            //lista obiektów
            $this->addElement((new Element\MultiCheckbox('fileObjects'))
                ->setLabel('form.connectorImportFilesForm.fileObjects.label')
                ->setMultioptions($data)
                ->setValue($data));

            //submit
            $this->addElement((new Element\Submit('submit'))
                ->setLabel('form.connectorImportFilesForm.submit.label'));
        }
    }
283111
protected function _update()
    {
        \App\Registry::$cache->remove('category-attributes-' . $this->id);
        //zmodyfikowany szablon
        if ($this->isModified('cmsCategoryTypeId')) {
            //iteracja po różnicy międy obecnymi atrybutami a nowymi
            foreach (array_diff(
                //obecne id atrybutów
                (new AttributeRelationModel('cmsCategoryType', $this->getInitialStateValue('cmsCategoryTypeId')))->getAttributeIds(),
                //nowe id atrybutów
                (new AttributeRelationModel('cmsCategoryType', $this->cmsCategoryTypeId))->getAttributeIds())
            as $deletedAttributeId) {
                //usuwanie wartości usuniętego atrybutu
                (new AttributeValueRelationModel('category', $this->id))
                    ->deleteAttributeValueRelationsByAttributeId($deletedAttributeId);
            }
        }
        //zmodyfikowany parent
        $parentModified = $this->isModified('parentId');
        //zmodyfikowany order
        $orderModified = $this->isModified('order');
        //zmodyfikowana aktywność
        $activeModified = $this->isModified('active');
        //zmodyfikowane uri
        $uriModified = $this->isModified('uri');
        //data modyfikacji
        $this->dateModify = date('Y-m-d H:i:s');
        //aktualizacja rekordu
        if (!parent::_update()) {
            return false;
        }
        //sortowanie dzieci po przestawieniu rodzica, lub kolejności
        if (($parentModified || $orderModified) && !$this->getOption('block-ordering')) {
            //sortuje dzieci
            $this->_sortChildren();
        }
        //zmieniono parenta, nazwę, lub aktywność
        if ($parentModified || $uriModified || $activeModified) {
            //przebudowa dzieci
            $this->_rebuildChildren($this->id);
        }
        //synchronizacja draftów
        if ($parentModified || $uriModified || $activeModified || $orderModified) {
            //synchronizacja pól w draftach
            $this->_synchronizeDrafts();
        }
        return true;
    }
591785
public function beforeSave()
    {
        //brak loginu lub hasła
        if (!$this->getElement('username')->getValue() || !$this->getElement('password')->getValue()) {
            return false;
        }
        //autoryzacja
        $auth = \App\Registry::$auth;
        \App\Registry::$auth->setIdentity($this->getElement('username')->getValue());
        \App\Registry::$auth->setCredential($this->getElement('password')->getValue());
        //autoryzacja
        if (!\App\Registry::$auth->authenticate()) {
            return false;
        }
        //zapamiętanie jeśli zaznaczona opcja
        if ($this->getElement('remember')) {
            \App\Registry::$auth->rememberMe(\App\Registry::$config->session->authRemember);
        }
        return true;
    }