Save Media Categories
488525
public function saveMediaCategories()
    {
        $mediaCategoryMapper = ($this->container->dataMapper)('MediaCategoryMapper');

        $categoriesPost = $this->request->getParsedBody();

        foreach ($categoriesPost['category'] as $key => $cat) {
            // Skip if category name is empty
            if (empty($cat)) {
                continue;
            }

            // Make category object
            $category = $mediaCategoryMapper->make();
            $category->id = $categoriesPost['id'][$key];

            // Check if we need to delete a category, but only if this has been previously saved with an ID
            if (isset($categoriesPost['delete'][$key]) && !empty($categoriesPost['id'][$key])) {
                $mediaCategoryMapper->delete($category);
            }

            // Save
            $category->category = $cat;
            $mediaCategoryMapper->save($category);
        }

        // Return to showing categories
        return $this->redirect('adminEditMediaCategories');
    }
905747
function(category, name, desc) {

            if(used[name]) return;
            used[name]= 1;

            if(!items[category]) items[category] = [];
            
           items[category].push({
               name: name,
               desc: desc
           });
        }
324246
function() {
        // Initialize category filters
        this._categoryFilters = [];
        var aInitialCategories = Logger.categories;

        for(var j=0; j < aInitialCategories.length; j++) {
            var sCategory = aInitialCategories[j];

            // Add category to the internal array of filters
            this._categoryFilters.push(sCategory);

            // Add checkbox element if UI is enabled
            if(this._elCategoryFilters) {
                this._createCategoryCheckbox(sCategory);
            }
        }
    }
1009294
def save(self):
        
        d = self._to_dict()
        if len(d.get('videoIds', [])) > 0:
            if not self.id:
                self.id = self.connection.post('create_playlist', playlist=d)
            else:
                data = self.connection.post('update_playlist', playlist=d)
                if data:
                    self._load(data)
678968
def _categorize(self, category):
		""""""
		self.torrents = [result for result in self.torrents
						 if result.category == category]
167241
def save_channels(self, checked=False, test_name=None):
        """"""
        self.read_group_info()

        if self.filename is not None:
            filename = self.filename
        elif self.parent.info.filename is not None:
            filename = (splitext(self.parent.info.filename)[0] +
                        '_channels.json')
        else:
            filename = None

        if test_name is None:
            filename, _ = QFileDialog.getSaveFileName(self,
                                                      'Save Channels Montage',
                                                      filename,
                                                      'Channels File (*.json)')
        else:
            filename = test_name

        if filename == '':
            return

        self.filename = filename

        groups = deepcopy(self.groups)
        for one_grp in groups:
            one_grp['color'] = one_grp['color'].rgba()

        with open(filename, 'w') as outfile:
            dump(groups, outfile, indent=' ')
1009441
public function save()
    {
        parent::save();

        $myConfig = \OxidEsales\Eshop\Core\Registry::getConfig();

        $soxId = $this->getEditObjectId();

        $aParams = $this->_parseRequestParametersForSave(
            $myConfig->getRequestParameter("editval")
        );

        /** @var \OxidEsales\Eshop\Application\Model\Category $oCategory */
        $oCategory = $this->createCategory();

        if ($soxId != self::NEW_CATEGORY_ID) {
            $this->resetCounter("catArticle", $soxId);
            $this->resetCategoryPictures($oCategory, $aParams, $soxId);
        }

        //Disable editing for derived items
        if ($oCategory->isDerived()) {
            return;
        }

        $oCategory = $this->updateCategoryOnSave($oCategory, $aParams);

        $oCategory->save();

        $this->setEditObjectId($oCategory->getId());
    }
123630
def _FlushCache(cls, format_categories):
    
    if definitions.FORMAT_CATEGORY_ARCHIVE in format_categories:
      cls._archive_remainder_list = None
      cls._archive_scanner = None
      cls._archive_store = None

    if definitions.FORMAT_CATEGORY_COMPRESSED_STREAM in format_categories:
      cls._compressed_stream_remainder_list = None
      cls._compressed_stream_scanner = None
      cls._compressed_stream_store = None

    if definitions.FORMAT_CATEGORY_FILE_SYSTEM in format_categories:
      cls._file_system_remainder_list = None
      cls._file_system_scanner = None
      cls._file_system_store = None

    if definitions.FORMAT_CATEGORY_STORAGE_MEDIA_IMAGE in format_categories:
      cls._storage_media_image_remainder_list = None
      cls._storage_media_image_scanner = None
      cls._storage_media_image_store = None

    if definitions.FORMAT_CATEGORY_VOLUME_SYSTEM in format_categories:
      cls._volume_system_remainder_list = None
      cls._volume_system_scanner = None
      cls._volume_system_store = None
281055
def download_from_category(category_name, output_path, width):
    """"""
    file_names = get_category_files_from_api(category_name)
    files_to_download = izip_longest(file_names, [], fillvalue=width)
    download_files_if_not_in_manifest(files_to_download, output_path)
425768
def save_feature(self, cat, img, feature, data):
        """"""
        filename = self.path(cat, img, feature)
        mkdir(filename)
        savemat(filename, {'output':data})
1360443
public function save()
    {
        if (Yii::$app instanceof Application) {
            Media::updateAll([
                'model_id' => $this->owner->getPrimaryKey(),
            ], [
                'AND',
                ['=', 'model', $this->owner::className()],
                ['IN', 'id', Yii::$app->request->post($this->name, [])],
            ]);
        }
    }
235528
def set_categories(self):
        """"""
        self.categories = []
        temp_categories = self.soup.findAll('category')
        for category in temp_categories:
            category_text = category.string
            self.categories.append(category_text)
1363378
def insert_virtual_media(self, url, device='FLOPPY'):
        """"""
        dic = {
            'DEVICE': device.upper(),
            'IMAGE_URL': url,
        }
        data = self._execute_command(
            'INSERT_VIRTUAL_MEDIA', 'RIB_INFO', 'write', dic)
        return data
928200
function saveCategoryList(categoryObject){
    var destinationPath = config.dest + 'db_category_list.json';
    grunt.file.write(destinationPath, JSON.stringify(categoryObject, null, 4));
    grunt.log.writeln('Prefixed file "' + destinationPath + '" created.');
  }
373416
def save
      @google_api.update_listing_for_language(language: language,
                                              title: title,
                                              short_description: short_description,
                                              full_description: full_description,
                                              video: video)
    end
1358807
public function ManageCategories() {
      // Check permission
      $this->Permission('Garden.Settings.Manage');
      
      $this->AddSideMenu('vanilla/settings/managecategories');
      
      // Nested sortable always breaks when we update jQuery so we give it it's own old version of jquery.
      $this->RemoveJsFile('jquery.js');
      $this->AddJsFile('js/library/nestedSortable.1.3.4/jquery-1.7.2.min.js', '', array('Sort' => 0));
      
      $this->AddJsFile('categories.js');
      $this->AddJsFile('js/library/jquery.alphanumeric.js');
      $this->AddJsFile('js/library/nestedSortable.1.3.4/jquery-ui-1.8.11.custom.min.js');
      $this->AddJsFile('js/library/nestedSortable.1.3.4/jquery.ui.nestedSortable.js');
      $this->Title(T('Categories'));
      
      // Get category data
      $this->SetData('CategoryData', $this->CategoryModel->GetAll('TreeLeft'), TRUE);
      
      // Enable/Disable Categories
      if (Gdn::Session()->ValidateTransientKey(GetValue(1, $this->RequestArgs))) {
         $Toggle = GetValue(0, $this->RequestArgs, '');
         if ($Toggle == 'enable') {
            SaveToConfig('Vanilla.Categories.Use', TRUE);
         } else if ($Toggle == 'disable') {
            SaveToConfig('Vanilla.Categories.Use', FALSE);
         }
         Redirect('vanilla/settings/managecategories');
      }
      
      // Setup & save forms
      $Validation = new Gdn_Validation();
      $ConfigurationModel = new Gdn_ConfigurationModel($Validation);
      $ConfigurationModel->SetField(array(
         'Vanilla.Categories.MaxDisplayDepth',
         'Vanilla.Categories.DoHeadings',
         'Vanilla.Categories.HideModule'
      ));
      
      // Set the model on the form.
      $this->Form->SetModel($ConfigurationModel);
      
      // Define MaxDepthOptions
      $DepthData = array();
      $DepthData['2'] = sprintf(T('more than %s deep'), Plural(1, '%s level', '%s levels'));
      $DepthData['3'] = sprintf(T('more than %s deep'), Plural(2, '%s level', '%s levels'));
      $DepthData['4'] = sprintf(T('more than %s deep'), Plural(3, '%s level', '%s levels')) ;
      $DepthData['0'] = T('never');
      $this->SetData('MaxDepthData', $DepthData);
      
      // If seeing the form for the first time...
      if ($this->Form->AuthenticatedPostBack() === FALSE) {
         // Apply the config settings to the form.
         $this->Form->SetData($ConfigurationModel->Data);
      } else {
         if ($this->Form->Save() !== FALSE)
            $this->InformMessage(T("Your settings have been saved."));
      }
      
      // Render default view
      $this->Render();
   }
686885
def save(self, *args, **kwargs):
        """"""

        super(MP4, self).save(*args, **kwargs)