当前位置: 首页>>代码示例>>PHP>>正文


PHP Note::getAll方法代码示例

本文整理汇总了PHP中Note::getAll方法的典型用法代码示例。如果您正苦于以下问题:PHP Note::getAll方法的具体用法?PHP Note::getAll怎么用?PHP Note::getAll使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Note的用法示例。


在下文中一共展示了Note::getAll方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: testSimpleUserImportWhereAllRowsSucceed

 public function testSimpleUserImportWhereAllRowsSucceed()
 {
     Yii::app()->user->userModel = User::getByUsername('super');
     $notes = Note::getAll();
     $this->assertEquals(0, count($notes));
     $import = new Import();
     $serializedData['importRulesType'] = 'Notes';
     $serializedData['firstRowIsHeaderRow'] = true;
     $import->serializedData = serialize($serializedData);
     $this->assertTrue($import->save());
     ImportTestHelper::createTempTableByFileNameAndTableName('simpleImportTest.csv', $import->getTempTableName(), true, Yii::getPathOfAlias('application.modules.notes.tests.unit.files'));
     $this->assertEquals(4, ImportDatabaseUtil::getCount($import->getTempTableName()));
     // includes header rows.
     $mappingData = array('column_0' => ImportMappingUtil::makeTextAreaColumnMappingData('description'), 'column_1' => ImportMappingUtil::makeDateTimeColumnMappingData('occurredOnDateTime'), 'column_2' => ImportMappingUtil::makeModelDerivedColumnMappingData('AccountDerived'), 'column_3' => ImportMappingUtil::makeModelDerivedColumnMappingData('ContactDerived'), 'column_4' => ImportMappingUtil::makeModelDerivedColumnMappingData('OpportunityDerived'));
     $importRules = ImportRulesUtil::makeImportRulesByType('Notes');
     $page = 0;
     $config = array('pagination' => array('pageSize' => 50));
     //This way all rows are processed.
     $dataProvider = new ImportDataProvider($import->getTempTableName(), true, $config);
     $dataProvider->getPagination()->setCurrentPage($page);
     $importResultsUtil = new ImportResultsUtil($import);
     $messageLogger = new ImportMessageLogger();
     ImportUtil::importByDataProvider($dataProvider, $importRules, $mappingData, $importResultsUtil, new ExplicitReadWriteModelPermissions(), $messageLogger);
     $importResultsUtil->processStatusAndMessagesForEachRow();
     //Confirm that 3 models where created.
     $notes = Note::getAll();
     $this->assertEquals(3, count($notes));
     $notes = Note::getByName('note1');
     $this->assertEquals(1, count($notes[0]));
     $this->assertEquals(1, count($notes[0]->activityItems));
     $this->assertEquals('testAccount', $notes[0]->activityItems[0]->name);
     $this->assertEquals('Account', get_class($notes[0]->activityItems[0]));
     $this->assertEquals('2011-12-22 05:03', substr($notes[0]->latestDateTime, 0, -3));
     $notes = Note::getByName('note2');
     $this->assertEquals(1, count($notes[0]));
     $this->assertEquals(1, count($notes[0]->activityItems));
     $this->assertEquals('testContact', $notes[0]->activityItems[0]->firstName);
     $this->assertEquals('Contact', get_class($notes[0]->activityItems[0]));
     $this->assertEquals('2011-12-22 05:03', substr($notes[0]->latestDateTime, 0, -3));
     $notes = Note::getByName('note3');
     $this->assertEquals(1, count($notes[0]));
     $this->assertEquals(1, count($notes[0]->activityItems));
     $this->assertEquals('testOpportunity', $notes[0]->activityItems[0]->name);
     $this->assertEquals('Opportunity', get_class($notes[0]->activityItems[0]));
     $this->assertEquals('2011-12-22 06:03', substr($notes[0]->latestDateTime, 0, -3));
     //Confirm 10 rows were processed as 'created'.
     $this->assertEquals(3, ImportDatabaseUtil::getCount($import->getTempTableName(), "status = " . ImportRowDataResultsUtil::CREATED));
     //Confirm that 0 rows were processed as 'updated'.
     $this->assertEquals(0, ImportDatabaseUtil::getCount($import->getTempTableName(), "status = " . ImportRowDataResultsUtil::UPDATED));
     //Confirm 2 rows were processed as 'errors'.
     $this->assertEquals(0, ImportDatabaseUtil::getCount($import->getTempTableName(), "status = " . ImportRowDataResultsUtil::ERROR));
     $beansWithErrors = ImportDatabaseUtil::getSubset($import->getTempTableName(), "status = " . ImportRowDataResultsUtil::ERROR);
     $this->assertEquals(0, count($beansWithErrors));
 }
开发者ID:maruthisivaprasad,项目名称:zurmo,代码行数:54,代码来源:NoteImportTest.php

示例2: testSuperUserAllDefaultControllerActions

 public function testSuperUserAllDefaultControllerActions()
 {
     $super = $this->logoutCurrentUserLoginNewUserAndGetByUsername('super');
     $superAccountId = self::getModelIdByModelNameAndName('Account', 'superAccount');
     $superAccountId2 = self::getModelIdByModelNameAndName('Account', 'superAccount2');
     $superContactId = self::getModelIdByModelNameAndName('Contact', 'superContact superContactson');
     $account = Account::getById($superAccountId);
     $account2 = Account::getById($superAccountId2);
     $contact = Contact::getById($superContactId);
     //confirm no existing activities exist
     $activities = Activity::getAll();
     $this->assertEquals(0, count($activities));
     //Test just going to the create from relation view.
     $this->setGetArray(array('relationAttributeName' => 'Account', 'relationModelId' => $superAccountId, 'relationModuleId' => 'accounts', 'redirectUrl' => 'someRedirect'));
     $this->runControllerWithNoExceptionsAndGetContent('notes/default/createFromRelation');
     //add related note for account using createFromRelation action
     $activityItemPostData = array('account' => array('id' => $superAccountId));
     $this->setGetArray(array('relationAttributeName' => 'Account', 'relationModelId' => $superAccountId, 'relationModuleId' => 'accounts', 'redirectUrl' => 'someRedirect'));
     $this->setPostArray(array('ActivityItemForm' => $activityItemPostData, 'Note' => array('description' => 'myNote')));
     $this->runControllerWithRedirectExceptionAndGetContent('notes/default/createFromRelation');
     //now test that the new note exists, and is related to the account.
     $notes = Note::getAll();
     $this->assertEquals(1, count($notes));
     $this->assertEquals('myNote', $notes[0]->description);
     $this->assertEquals(1, $notes[0]->activityItems->count());
     $activityItem1 = $notes[0]->activityItems->offsetGet(0);
     $this->assertEquals($account, $activityItem1);
     //test viewing the existing note in a details view
     $this->setGetArray(array('id' => $notes[0]->id));
     $this->resetPostArray();
     $this->runControllerWithNoExceptionsAndGetContent('notes/default/details');
     //test editing an existing note and saving.
     //First just go to the edit view and confirm it loads ok.
     $this->setGetArray(array('id' => $notes[0]->id, 'redirectUrl' => 'someRedirect'));
     $this->resetPostArray();
     $this->runControllerWithNoExceptionsAndGetContent('notes/default/edit');
     //Save changes via edit action.
     $activityItemPostData = array('Account' => array('id' => $superAccountId), 'Contact' => array('id' => $superContactId));
     $this->setGetArray(array('id' => $notes[0]->id, 'redirectUrl' => 'someRedirect'));
     $this->setPostArray(array('ActivityItemForm' => $activityItemPostData, 'Note' => array('description' => 'myNoteX')));
     $this->runControllerWithRedirectExceptionAndGetContent('notes/default/edit');
     //Confirm changes applied correctly.
     $notes = Note::getAll();
     $this->assertEquals(1, count($notes));
     $this->assertEquals('myNoteX', $notes[0]->description);
     $this->assertEquals(2, $notes[0]->activityItems->count());
     $activityItem1 = $notes[0]->activityItems->offsetGet(0);
     $activityItem2 = $notes[0]->activityItems->offsetGet(1);
     $this->assertEquals($account, $activityItem1);
     $this->assertEquals($contact, $activityItem2);
     //Remove contact relation.  Switch account relation to a different account.
     $activityItemPostData = array('Account' => array('id' => $superAccountId2));
     $this->setGetArray(array('id' => $notes[0]->id));
     $this->setPostArray(array('ActivityItemForm' => $activityItemPostData, 'Note' => array('description' => 'myNoteX')));
     $this->runControllerWithRedirectExceptionAndGetContent('notes/default/edit');
     //Confirm changes applied correctly.
     $notes = Note::getAll();
     $this->assertEquals(1, count($notes));
     $this->assertEquals('myNoteX', $notes[0]->description);
     $this->assertEquals(1, $notes[0]->activityItems->count());
     $activityItem1 = $notes[0]->activityItems->offsetGet(0);
     $this->assertEquals($account2, $activityItem1);
     //Test validating an existing note via the inline edit validation (failed Validation)
     $activityItemPostData = array('Account' => array('id' => $superAccountId), 'Contact' => array('id' => $superContactId));
     $this->setGetArray(array('id' => $notes[0]->id, 'redirectUrl' => 'someRedirect'));
     $this->setPostArray(array('ActivityItemForm' => $activityItemPostData, 'ajax' => 'inline-edit-form', 'Note' => array('description' => '')));
     $content = $this->runControllerWithExitExceptionAndGetContent('notes/default/inlineCreateSave');
     $this->assertTrue(strlen($content) > 20);
     //approximate, but should definetely be larger than 20.
     //Test validating an existing note via the inline edit validation (Success)
     $this->setPostArray(array('ActivityItemForm' => $activityItemPostData, 'ajax' => 'inline-edit-form', 'Note' => array('description' => 'a Valid Name of a Note')));
     $content = $this->runControllerWithExitExceptionAndGetContent('notes/default/inlineCreateSave');
     $this->assertEquals('[]', $content);
     //Test saving an existing note via the inline edit validation
     $this->setPostArray(array('ActivityItemForm' => $activityItemPostData, 'Note' => array('description' => 'a Valid Name of a Note')));
     $content = $this->runControllerWithRedirectExceptionAndGetContent('notes/default/inlineCreateSave');
     //Confirm changes applied correctly.
     $notes = Note::getAll();
     $this->assertEquals(2, count($notes));
     $this->assertEquals('a Valid Name of a Note', $notes[1]->description);
     //test removing a note.
     $this->setGetArray(array('id' => $notes[1]->id));
     $this->resetPostArray();
     $this->runControllerWithRedirectExceptionAndGetContent('notes/default/delete');
     //Confirm no more notes exist.
     $notes = Note::getAll();
     $this->assertEquals(1, count($notes));
 }
开发者ID:maruthisivaprasad,项目名称:zurmo,代码行数:88,代码来源:NotesSuperUserWalkthroughTest.php

示例3: json_encode

            $res = self::query("UPDATE `notes` SET `title` = '{$title}', `message` = '{$message}' WHERE `notes`.`id` = {$id}");
        }
        // Return query result
        return json_encode($res);
    }
    public static function delete($id)
    {
        $res = self::query("DELETE FROM notes WHERE `id` = {$id}");
        return $res;
    }
}
// Our script requires JSON data format
// Set Content-Type to JSON
header('Content-Type: application/json');
// if GET request then return the list of all items
// if POST request then add, edit or delete
switch ($_SERVER['REQUEST_METHOD']) {
    case 'GET':
        echo Note::getAll();
        break;
    case 'POST':
        if (isset($_POST['action'])) {
            echo Note::delete($_POST['id']);
        } else {
            print_r(Note::save($_POST));
        }
        break;
    default:
        echo 'Unknown operation';
        break;
}
开发者ID:BriniDesigner,项目名称:Todo-list,代码行数:31,代码来源:todo.php

示例4: getSelect

 function getSelect($sort = "content", $order = "ASC")
 {
     $results = Note::getAll(null, $sort, $order);
     $temp = array(array("label" => "Edit item"));
     foreach ($results as $row) {
         $temp[] = array("value" => $row['id'], "label" => str_replace("\n", " /", stripslashes($row['content'])));
     }
     return $temp;
 }
开发者ID:npedrini,项目名称:anthroposts,代码行数:9,代码来源:note.class.php

示例5: array

	<div>
		<a href='browse.php?cid=".$cid."&tid=".$tid."&h=25'>small</a> | 
		<a href='browse.php?cid=".$cid."&tid=".$tid."&h=50'>med</a> |
		<a href='browse.php?cid=".$cid."&tid=".$tid."&h=75'>large</a>
	</div>";

$where = array();
if(!is_null($cid) && !empty($cid)){
	$category = new Category($cid);
	$where["category_id"] = $cid;
}

if(!is_null($tid) && !empty($tid)){
	$where["type_id"] = $tid;
}

$all_notes = Note::getAll( $where );


foreach($all_notes as $note){
	echo "
		<div style='float:left;'>
			<a href='index.php?id=".$note['id']."'>
				<img border='0' src='../image.php?id=".$note['id']."&h=".$h."' />
			</a>
			<br/><span style='font-size:9px'>".nl2br($note['content'])."</span>
		</div>";
}

}
?>
开发者ID:npedrini,项目名称:anthroposts,代码行数:31,代码来源:browse.php

示例6: testPostingAnNoteCarriesPermissionsCorrectly

 /**
  * @depends testPostGameNotificationToProfile
  */
 public function testPostingAnNoteCarriesPermissionsCorrectly()
 {
     if (!SECURITY_OPTIMIZED) {
         return;
     }
     $super = $this->logoutCurrentUserLoginNewUserAndGetByUsername('super');
     $socialItems = SocialItem::getAll();
     $this->assertEquals(2, count($socialItems));
     $superAccountId = self::getModelIdByModelNameAndName('Account', 'superAccount');
     $activityItemPostData = array('Account' => array('id' => $superAccountId));
     $this->setGetArray(array('redirectUrl' => 'someRedirect'));
     $this->setPostArray(array('ActivityItemForm' => $activityItemPostData, 'postToProfile' => true, 'Note' => array('description' => 'a note that is promoted')));
     $content = $this->runControllerWithRedirectExceptionAndGetContent('notes/default/inlineCreateSave');
     $notes = Note::getAll();
     $this->assertEquals(1, count($notes));
     $socialItems = SocialItem::getAll();
     $this->assertEquals(3, count($socialItems));
     $this->assertEquals($notes[0]->id, $socialItems[2]->note->id);
     $this->assertNull($socialItems[2]->description);
 }
开发者ID:youprofit,项目名称:Zurmo,代码行数:23,代码来源:SocialItemsUserWalkthroughTest.php

示例7: clearDirectory

//	remove old images
clearDirectory( $target_dir );

//	create new
$db = new Database( "db13310_notes" );
$sql  = "SELECT id,image_full,image_full_back FROM notes";
$query = $db->query($sql);
$items = array();

while($row = $db->getRow($query)){
	$items[] = $row;
}

if( isset( $_GET['id'] ) )
{
	$images = Note::getAll( array( "id" => $_GET['id'] ) );
}

foreach($items as $item)
{
	if( isset( $item['image_full'] ) ) createImage( $item, 'image_full' );
	if( isset( $item['image_full_back'] ) ) createImage( $item, 'image_full_back', '_back' );
}

function createImage( $item, $data_field, $suffix = '' )
{
	$defs = array
	(
		array('ext'=>'tiny','height'=>30,'crop'=>false)
	);
开发者ID:npedrini,项目名称:anthroposts,代码行数:30,代码来源:create_images.php

示例8: testDeleteNote

 /**
  * @depends testUpdateNoteFromForm
  */
 public function testDeleteNote()
 {
     Yii::app()->user->userModel = User::getByUsername('super');
     $notes = Note::getAll();
     $this->assertEquals(2, count($notes));
     $notes[0]->delete();
     $notes = Note::getAll();
     $this->assertEquals(1, count($notes));
 }
开发者ID:youprofit,项目名称:Zurmo,代码行数:12,代码来源:NoteTest.php


注:本文中的Note::getAll方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。