Usuwanie atrybutu
19115
public function deleteAction()
    {
        $attribute = (new \Cms\Orm\CmsAttributeQuery)->findPk($this->id);
        if ($attribute && $attribute->delete()) {
            $this->getMessenger()->addMessage('messenger.attribute.deleted', true);
        }
        $this->getResponse()->redirect('cmsAdmin', 'attribute', 'index');
    }
181488
@Override
	public void executeTemplate(String templateName, Map<String, Object> properties, String workDir) {
		// Pobieranie definicji szablonu do użycia:
		Template<?> template = templateProvider.get(templateName, null, null, null);
		if(template == null) {
			throw new RuntimeException("Nie znaleziono szablonu " + templateName);
		}
		if(template.isAbstract()) {
			throw new AbstractTemplateException(templateName);
		}

		// Weryfikowanie definicji szablonu, szablonu nadrzędnego i wszystkich
		// szablonów używanych. Sprawdzanie dostępność klas silników generatorów.
		templateVerifier.verifyTemplate(template, templateProvider);

		MapStack<String, Object> propertiesStack = new SimpleMapStack<String,Object>();
		propertiesStack.push(new HashMap<String, Object>(properties));
		doExecuteTemplate(template, propertiesStack, workDir);
		propertiesStack.pop();
	}
580761
def insert_attribute(self, att, index):
        
        javabridge.call(self.jobject, "insertAttributeAt", "(Lweka/core/Attribute;I)V", att.jobject, index)
600411
public void insert_us(final short[] argIn) {
		attributeValue_5.data_format = AttrDataFormat.FMT_UNKNOWN;
		attributeValue_5.w_dim.dim_x = argIn.length;
		attributeValue_5.w_dim.dim_y = 0;
		if (use_union) {
	    	attributeValue_5.value.ushort_att_value(argIn);
		} else {
	    	deviceAttribute_3.insert_us(argIn);
		}
    }
1166645
function attributable(form, c, name) {
  if (form._vals == null)
    form._vals = {};
  if (form._update == null)
    form._update = function () {
      for (var p in form._vals)
        form._vals[p].data == form._data[p];
    }
  form._vals[name] = c;
  c.on('change', function () {
    form._data[name] = c.data;
    form.emit('change');
  });
}
1165756
public function afterSave()
    {
        //sprawdzenie istnienia rekordu
        if ($this->hasRecord()) {
            $this->_appendFiles($this->_record->getPk(), $this->getFiles());
        }
        //po uploadzie
        $this->afterUpload();
        return true;
    }
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;
    }
254187
public function afterSave()
    {
        //brak obiektu
        if (!$this->_saveToObject) {
            return parent::afterSave();
        }
        //czyszczenie relacji
        (new AttributeValueRelationModel($this->_saveToObject, $this->getRecord()->id))->deleteAttributeValueRelations();
        //iteracja po elementach
        foreach ($this->_cmsAttributeElements as $attributeId => $element) {
            //zapis relacji
            $this->_createValueRelationByElement($attributeId, $element);
        }
        //iteracja po atrybutach
        foreach ($this->_cmsAttributes as $attribute) {
            //nie jest zmaterializowany, odziedziczony
            if (!$attribute->getJoined('cms_attribute_relation')->isMaterializedInherited()) {
                continue;
            }
            //brak obiektu do dziedziczenia
            if (null === $element = $this->getElement($attribute->key)) {
                throw new \Exception('No inherited attribute: ' . $attribute->key);
            }
            //zapis relacji z odziedziczonego elementu formularza (występującego w oryginalnym formularzu)
            $this->_createValueRelationByElement($attribute->id, $element);
        }
        //zapis udany
        return parent::afterSave();
    }
33697
public function indexAction()
    {
        if (!$this->name) {
            return '';
        }
        //lista dozwolonych znaków
        $characters = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'J', 'K', 'L', 'M', 'N', 'P', 'R', 'S', 'T', 'U', 'W', 'Z'];
        $word = '';
        $charsCount = count($characters) - 1;

        //generuje 5 literowy string
        for ($i = 0; $i < 5; $i++) {
            $word .= $characters[rand(0, $charsCount)];
        }

        //tworzenie obrazu
        $img = imagecreatetruecolor(130, 50);

        //konfiguracja kolorów
        $green = imagecolorallocate($img, 0x00, 0x77, 0x00);
        $gray = imagecolorallocate($img, 0xF5, 0xF5, 0xF5);
        $darkGray = imagecolorallocate($img, 0x99, 0x99, 0x99);

        //czcionka
        $font = BASE_PATH . '/web/resource/cmsAdmin/ttf/dejavu.ttf';

        //ramka
        imagefilledrectangle($img, 0, 0, 129, 49, $darkGray);
        imagefilledrectangle($img, 1, 1, 128, 48, $gray);

        $prevSpace = -5;
        $prevAngle = 0;

        //przesunięcia i obroty
        for ($i = 0; $i < strlen($word); $i++) {
            if ($i % 2 != 0) {
                $size = rand(32, 36);
                $height = rand(42, 46);
                $angle = rand(5, 15);
                $space = 25 + $prevSpace;
            } else {
                $size = rand(28, 32);
                $height = rand(39, 43);
                $angle = rand(-15, 5);
                $space = 13 + $prevSpace;
            }
            $prevSpace = $space;
            $prevAngle = $angle;
            imagefttext($img, $size, $angle, $space, $height, $green, $font, $word[$i]);
        }

        //zapis do sesji
        $formSession = new \Mmi\Session\SessionSpace('captcha');
        //filtracja nazwy pola z nazwy formularza + pola
        $name = strpos($this->name, '[') === false ? $this->name : substr($this->name, strpos($this->name, '[') + 1, -1);
        $formSession->$name = $word;

        //ustalenie nagłówka na niebuforowany
        $this->getResponse()
            ->setHeader('Expires', 'Mon, 15 Dec ' . (date('Y') - 1) . ' 01:00:00 GMT+0100')
            ->setHeader('Last-Modified', gmdate('D, d M Y H:i:s') . ' GMT')
            ->setHeader('Cache-Control', 'no-store, no-cache, must-revalidate')
            ->setHeader('Cache-Control', 'post-check=0, pre-check=0', false)
            ->setHeader('Pragma', 'no-cache')
            ->setTypeJpeg();

        //zwrot obrazu
        imagejpeg($img, NULL, 25);
        return '';
    }
336306
public function commitVersion()
    {
        //sprawdzenie czy posiada rodzica (oryginał)
        if (!$this->cmsCategoryOriginalId) {
            return true;
        }
        //wyszukiwanie oryginału
        $originalRecord = (new CmsCategoryQuery)->findPk($this->cmsCategoryOriginalId);
        //tworzenie wersji
        $versionModel = new \Cms\Model\CategoryVersion($originalRecord);
        $versionModel->create();
        //zmiana miejscami draftu z oryginałem
        return $versionModel->exchangeOriginal($this);
    }
1011625
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());
        return \App\Registry::$auth->authenticate();
    }
632712
def attn(image_feat, query, hparams, name="attn"):
  """"""
  with tf.variable_scope(name, "attn", values=[image_feat, query]):
    attn_dim = hparams.attn_dim
    num_glimps = hparams.num_glimps
    num_channels = common_layers.shape_list(image_feat)[-1]
    if len(common_layers.shape_list(image_feat)) == 4:
      image_feat = common_layers.flatten4d3d(image_feat)
    query = tf.expand_dims(query, 1)
    image_proj = common_attention.compute_attention_component(
        image_feat, attn_dim, name="image_proj")
    query_proj = common_attention.compute_attention_component(
        query, attn_dim, name="query_proj")
    h = tf.nn.relu(image_proj + query_proj)
    h_proj = common_attention.compute_attention_component(
        h, num_glimps, name="h_proj")
    p = tf.nn.softmax(h_proj, axis=1)
    image_ave = tf.matmul(image_feat, p, transpose_a=True)
    image_ave = tf.reshape(image_ave, [-1, num_channels*num_glimps])

    return image_ave
26267
@Override
  public Font getFont( AttributeSet attr )
  {
    boolean bUnderline = StyleConstants.isUnderline( attr );
    boolean bStrikethrough = StyleConstants.isStrikeThrough( attr );

    if( !bUnderline && !bStrikethrough )
    {
      // StyleContext ignores the Underline and Strikethrough attribute
      return getFont( attr, getFontFamily( attr ) );
    }

    // Must build the font via TextAttribute map to support Underlined and Strikethrough text

    Map<TextAttribute, Object> map = new HashMap<TextAttribute, Object>();
    map.put( TextAttribute.FAMILY, getFontFamily( attr ) );
    map.put( TextAttribute.SIZE, (float)getFontSize() );
    map.put( TextAttribute.WEIGHT, StyleConstants.isBold( attr ) ? TextAttribute.WEIGHT_BOLD : TextAttribute.WEIGHT_REGULAR );
    map.put( TextAttribute.POSTURE, StyleConstants.isItalic( attr ) ? TextAttribute.POSTURE_OBLIQUE : TextAttribute.POSTURE_REGULAR );
    if( bUnderline )
    {
      map.put( TextAttribute.UNDERLINE, TextAttribute.UNDERLINE_ON );
      if( attr.getAttribute( DASHED ) != null )
      {
        map.put( TextAttribute.UNDERLINE, TextAttribute.UNDERLINE_LOW_GRAY );
      }
    }
    if( bStrikethrough )
    {
      map.put( TextAttribute.STRIKETHROUGH, TextAttribute.STRIKETHROUGH_ON );
    }

    Font font = _fontCache.get( attr );
    if( font == null )
    {
      font = new Font( map );
      _fontCache.put( attr, font );
    }

    return font;
  }
19811
public void insert_us(final int[] argIn) {
		attributeValue_5.data_format = AttrDataFormat.FMT_UNKNOWN;
		final short[] values = new short[argIn.length];
		for (int i = 0; i < argIn.length; i++) {
	    	values[i] = (short) (argIn[i] & 0xFFFF);
		}
		attributeValue_5.w_dim.dim_x = argIn.length;
		attributeValue_5.w_dim.dim_y = 0;
		if (use_union) {
	    	attributeValue_5.value.ushort_att_value(values);
		} else {
	    	deviceAttribute_3.insert_us(argIn);
		}
    }
103721
private function _buildFlatTree($prefix, array &$flatTree, array $categories, $categoryTypeKey)
    {
        //iteracja po kategoriach
        foreach ($categories as $id => $leaf) {
            if (null === $categoryTypeKey || $leaf['record']->getJoined('cms_category_type')->key === $categoryTypeKey) {
                //dodanie rekordu z prefixem i nazwą
                $flatTree[$id] = ltrim($prefix . ' > ' . $leaf['record']->name, ' >');
            }
            //zejście rekurencyjne
            $this->_buildFlatTree($prefix . ' > ' . $leaf['record']->name, $flatTree, $leaf['children'], $categoryTypeKey);
        }
    }
78599
def create_usuario(self):
        """"""
        return Usuario(
            self.networkapi_url,
            self.user,
            self.password,
            self.user_ldap)
395244
@Override
    public Object runUnderUOW(int uowType, boolean join, ExtendedUOWAction uowAction, Class<?>[] rollbackOn, Class<?>[] dontRollbackOn) throws Exception {
        throw new IllegalStateException();
    }