Ejemplo n.º 1
0
    ?>
				<?php 
    echo CHtml::label($priv, 'SchemaPrivilege_Privileges_' . $priv);
    ?>
<br />
			<?php 
}
?>
		</fieldset>
		<fieldset style="float: left; margin-left: 10px">
			<legend><?php 
echo Yii::t('core', 'administration');
?>
</legend>
			<?php 
foreach (array_keys(SchemaPrivilege::getAllPrivileges('administration')) as $priv) {
    ?>
				<?php 
    echo CHtml::checkBox('SchemaPrivilege[Privileges][' . $priv . ']', $schema->checkPrivilege($priv));
    ?>
				<?php 
    echo CHtml::label($priv, 'SchemaPrivilege_Privileges_' . $priv);
    ?>
<br />
			<?php 
}
?>
		</fieldset>
	</div>
	<div class="buttonContainer">
		<a href="javascript:void(0)" onclick="$('#<?php 
Ejemplo n.º 2
0
 public function actionDropSchema()
 {
     $response = new AjaxResponse();
     $response->refresh = true;
     $schemata = (array) $_POST['schemata'];
     $droppedSchemata = $droppedSqls = array();
     foreach ($schemata as $schema) {
         $schemaObj = SchemaPrivilege::model()->findByPk(array('Host' => $this->host, 'User' => $this->user, 'Db' => $schema));
         try {
             $sql = $schemaObj->delete();
             $droppedSchemata[] = $schema;
             $droppedSqls[] = $sql;
         } catch (DbException $ex) {
             $response->addNotification('error', Yii::t('core', 'errorDropSchemaSpecificPrivileges', array('{user}' => $user)), $ex->getText());
         }
     }
     $count = count($droppedSchemata);
     if ($count > 0) {
         $tArgs = array($count, '{user}' => $this->user, '{host}' => $this->host, '{schema}' => $droppedSchemata[0], '{schemaCount}' => $count);
         $response->addNotification('success', Yii::t('core', 'successDropSchemaSpecificPrivileges', $tArgs), $count > 1 ? implode(', ', $droppedSchemata) : null);
     }
     $this->sendJSON($response);
 }