コード例 #1
0
 public function getPresetConfig()
 {
     $list = opToolkit::getPresetProfileList();
     if (!empty($list[$this->getRawPresetName()])) {
         return $list[$this->getRawPresetName()];
     }
     return array();
 }
コード例 #2
0
 public function save($con = null)
 {
     $values = $this->getValues();
     $presetList = opToolkit::getPresetProfileList();
     $presetName = $values['preset'];
     $preset = $presetList[$presetName];
     $values = $this->mergePresetAndValues($preset, $values);
     $values['name'] = 'op_preset_' . $values['name'];
     unset($values['preset'], $values['choices'], $values['caption']);
     $this->values = $values;
     parent::save($con);
 }
コード例 #3
0
 public function generatePresetProfileOption($profileId)
 {
     $result = array();
     $profile = Doctrine::getTable('Profile')->find($profileId);
     if (!$profile || !$profile->isPreset()) {
         return $result;
     }
     $list = opToolkit::getPresetProfileList();
     if (!empty($list[$profile->getRawPresetName()]['Choices'])) {
         foreach ($list[$profile->getRawPresetName()]['Choices'] as $v) {
             $option = new opProfileOptionEmulator();
             $option->id = $v;
             $option->value = $v;
             $result[] = $option;
         }
     }
     return $result;
 }
コード例 #4
0
 protected function setProfileWidgets($profiles)
 {
     $presetList = opToolkit::getPresetProfileList();
     foreach ($profiles as $profile) {
         $profileI18n = $profile->Translation[sfContext::getInstance()->getUser()->getCulture()]->toArray();
         $profileWithI18n = $profile->toArray() + $profileI18n;
         $widgetOptions = array('widget' => opFormItemGenerator::generateWidget($profileWithI18n, $this->getFormOptionsValue($profile->getId())));
         $validatorOptions = array('validator' => opFormItemGenerator::generateValidator($profileWithI18n, $this->getFormOptions($profile->getId())));
         if ($profile->getIsEditPublicFlag()) {
             $widgetOptions['is_edit_public_flag'] = $validatorOptions['is_edit_public_flag'] = true;
             if (!$this->getDefault($profile->getName())) {
                 $this->setDefault($profile->getName(), array('public_flag' => $profile->getDefaultPublicFlag()));
             }
         }
         $this->widgetSchema[$profile->getName()] = new opWidgetFormProfile($widgetOptions);
         $this->validatorSchema[$profile->getName()] = new opValidatorProfile($validatorOptions);
         $this->widgetSchema[$profile->getName()]->profile = $profile;
         $this->validatorSchema[$profile->getName()]->profile = $profile;
         $this->widgetSchema->setHelp($profile->getName(), $profileWithI18n['info']);
         if ($profile->isPreset()) {
             $this->widgetSchema->setLabel($profile->getName(), $presetList[$profile->getRawPresetName()]['Caption']);
             if ('op_preset_self_introduction' === $profile->getName()) {
                 $this->widgetSchema->setHelp($profile->getName(), 'This Profile supported markdown format');
             }
         }
     }
 }
コード例 #5
0
 protected function setProfileWidgets($profiles)
 {
     $presetList = opToolkit::getPresetProfileList();
     foreach ($profiles as $profile) {
         if ('mobile_frontend' === sfConfig::get('sf_app')) {
             if ('op_preset_country' === $profile->getName() || 'op_preset_region' === $profile->getName()) {
                 continue;
             }
         }
         $profileI18n = $profile->Translation[sfContext::getInstance()->getUser()->getCulture()]->toArray();
         $profileWithI18n = $profile->toArray() + $profileI18n;
         $widgetOptions = array('widget' => opFormItemGenerator::generateWidget($profileWithI18n, $this->getFormOptionsValue($profile->getId())));
         $validatorOptions = array('validator' => opFormItemGenerator::generateValidator($profileWithI18n, $this->getFormOptions($profile->getId())));
         if ($profile->getIsEditPublicFlag()) {
             $widgetOptions['is_edit_public_flag'] = $validatorOptions['is_edit_public_flag'] = true;
             if (!$this->getDefault($profile->getName())) {
                 $this->setDefault($profile->getName(), array('public_flag' => $profile->getDefaultPublicFlag()));
             }
         }
         $this->widgetSchema[$profile->getName()] = new opWidgetFormProfile($widgetOptions);
         $this->validatorSchema[$profile->getName()] = new opValidatorProfile($validatorOptions);
         $this->widgetSchema[$profile->getName()]->profile = $profile;
         $this->validatorSchema[$profile->getName()]->profile = $profile;
         $this->widgetSchema->setHelp($profile->getName(), $profileWithI18n['info']);
         if ($profile->isPreset()) {
             $this->widgetSchema->setLabel($profile->getName(), $presetList[$profile->getRawPresetName()]['Caption']);
             if ('op_preset_birthday' === $profile->getName()) {
                 $this->widgetSchema->setHelp($profile->getName(), 'The public_flag for your age can be configure at "Settings" page.');
             }
         }
     }
 }
コード例 #6
0
ファイル: editSuccess.php プロジェクト: te-koyama/openpne
        echo $presetForm;
        ?>
</table>
<input type="submit" value="<?php 
        echo __('Add');
        ?>
" />
</form>
<?php 
    } else {
        echo __('There is no preset profile.');
    }
} else {
    ?>
<h3><?php 
    $presetList = opToolkit::getPresetProfileList();
    foreach ($presetList as $k => $v) {
        if ('op_preset_' . $v['Name'] === $profile['name']) {
            echo __($v['Caption']);
            break;
        }
    }
    ?>
</h3>
<form action="<?php 
    echo url_for('profile/edit?type=preset&id=' . $profile->getId());
    ?>
" method="post">
<table style="width: 50%;">
<?php 
    echo $presetForm;